Why is a boolean of False produced rather than true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is a boolean of False produced rather than true?

division = ["Division","Divide","/","div"] multiplication = ["*","x","times","multiply","multiplication","multiple"] subtraction = ["-",'minus','subtract','subtraction'] addition = ['+','plus','addition','add'] root = ['root','squareroot','square root'] square = ['square','squared','power 2'] choice = input('calculation type') print(choice == (division or multiplication or subtraction or addition))

15th Nov 2016, 2:18 PM
Dave Matthew
Dave Matthew - avatar
4 Answers
+ 4
Whenever you input the choice, the program is expecting the user to enter the entire list, not just a single element. Instead you should say something like: if choice in division: mode = 'd' Or something to that effect.
15th Nov 2016, 2:57 PM
Keto Z
Keto Z - avatar
+ 2
The only way to check for it in multiple lists would be to create a list of lists, I'd think.
15th Nov 2016, 10:15 PM
Keto Z
Keto Z - avatar
0
is it possible to check if choice is in multiple lists?
15th Nov 2016, 9:36 PM
Dave Matthew
Dave Matthew - avatar
0
THANKSSSS ILL GIVE IT A TRY LATER :D
15th Nov 2016, 10:16 PM
Dave Matthew
Dave Matthew - avatar