PYTHON CODE ONLY Given a variable currentmembers that refers
PYTHON CODE ONLY
Given:
a variable current_members that refers to a list, and
a variable member_id that has been defined.
Write some code that assigns True to a variable is_a_member if the value associated with member_id can be found in the list associated with current_members, but that otherwise assigns False to is_a_member. Use only current_members, member_id, and is_a_member.
Solution
current_members = [2, 3, 1]
member_id = 3
flag = 0
is_a_member = False
for i in current_members:
if i == member_id:
is_a_member = True
flag = 1
if flag == 0:
is_a_member = False
print is_a_member
