I have three lists:
List_1 = [5, 34, 9, 24, 8, 16]
List_2 = [24, 1, 16, 9, 6, 30]
List_3 = [44, 20, 3, 4, 9, 19]
Let's say a user can input any number from 1-49.
I want a condition that:
If the inputted number is present in List_1
but not in List_2
and not in List 3
-
Print ("100")
Else, if the inputted number is present in List_1
and List_2
but not in List 3
-
Print ("50")
Else, if the inputted number is present in List_1
and List_2
and List 3
-
Print ("150")
Else, Print ("200")
Let's say the input is 16,
16 appears in 2 lists.
This is what I did:
user_input = 16
List_1 = [5, 34, 9, 24, 8, 16]
List_2 = [24, 1, 16, 9, 6, 30]
List_3 = [44, 20, 3, 4, 9, 19]
if user_input in List_1 and not (List_2 and List_3):
print("100")
elif user_input in (List_1 and List_2) and not List_3:
print("50")
elif user_input in List_1 and List_2 and List_3:
print("150")
else:
print("200")
but the output is "150".