the lists mammals, amphibians, and reptiles contain a list of animals
name = input("please input a animal ") if name in mammals or name in amphibians or name in reptiles: print (idk what to put here) else: print ("it is not there")
Answer
Anthony is right that you can’t print a variable’s name directly, but we can do something like this:
name = input("please input a animal ") if name in mammals: print("mammals") elif name in amphibians: print("amphibians") elif name in reptiles: print("reptiles") else: print ("it is not there")
First, this checks if the animal is included in the list mammals
. If it is, we print “mammals”. We do the same for amphibians and reptiles. If the animal is in neither of those, we print “it is not there”.