Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

elif not working

+1 vote
asked Sep 20 by kuber mishra (130 points)
indian=["samosa","dal","roti",]
chinese=["eggrole","fried rice","chowmin"]
italian=["pizza","pasta","rissoto"]
dish=input("enter a disname:")
if dish in indian:
    print("indian")
    elseif dish in italian:
        print("italian")
        elif dish in chinese:
            print("chinese")
else:
    print("no idea")

1 Answer

+2 votes
answered Sep 20 by LiOS (6,340 points)
Assuming this is Python, the indentation is incorrect, and also your 2nd condition is using elseif, which is incorrect in Python and should be elif as used on the 3rd condition.

indian=["samosa","dal","roti"]
chinese=["eggrole","fried rice","chowmin"]
italian=["pizza","pasta","rissoto"]

dish= input("enter a dishname: ")

if dish in indian:
    print("indian")
elif dish in italian:
    print("italian")
elif dish in chinese:
    print("chinese")
else:
    print("no idea")
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...