0

Why There is Showing invalid santax

elif user_input == "div": num1 = float(input("enter a no")) num2 = float(input("enter")) result = str(num1 / num2) print( "answer is " + result)

14th Jul 2020, 11:09 PM
HELL_GAMER
HELL_GAMER - avatar
4 Réponses
0
Is there more code? I asked, bc there isnt the user_input. The code check a not existent input. And there is no if statement. elif is used, if there more than one possibility. Example: demo = input() if demo == "1": print("Its a 1") elif demo == "2": print("Well its a 2") else: print("No matter what is is, it isnt a 1 or a 2") You can say if stand for if. In example it was the if demo == 1 part. Elif stand for in case of. In the demo, it was the elif (in case of) demo == 2. The syntax is always the same: First the if, next the elif statements at last the else. The else statement stand for "in all other cases" Hope this help.
14th Jul 2020, 11:24 PM
Sven_m
Sven_m - avatar
0
Sven_m yep there is more i have written input also
15th Jul 2020, 5:35 AM
HELL_GAMER
HELL_GAMER - avatar
0
Sven_m can u check my code
15th Jul 2020, 5:35 AM
HELL_GAMER
HELL_GAMER - avatar
0
HELL_GAMER I wrote you a mail with feedback.
15th Jul 2020, 8:49 PM
Sven_m
Sven_m - avatar