what is wrong with this code ? it is printing only the last print line of invalid arguments selected | Sololearn: Learn to code for FREE!
0

what is wrong with this code ? it is printing only the last print line of invalid arguments selected

# this or that using python a = str(input("choose from the foll")) print('name' , 'place' , 'animal' , 'thing') name = ['bob' , 'tom'] place = ['india' , 'japan'] animal = ['dog' , 'cat'] thing = ['books' , 'crayons'] #choose = ('name' , 'place' , 'animal' , 'thing') if (a == name): print("This or That NAME") print(bob ^ Tom) elif (a == place): print("This or That place") print(india ^ japan) elif(a == animal): print("This or That animal") print(dog ^ cat) elif (a == thing): print("This or That thing") print(books ^ crayons) else: print("invalid arguments selected")

6th Aug 2022, 2:22 PM
prajakta gurav
1 Odpowiedź
+ 3
comparing a (str) with a list so all if result false.. What are you trying like by a == name : ?
6th Aug 2022, 2:31 PM
Jayakrishna 🇮🇳