M
M
memiss2020-07-07 13:42:07
Python
memiss, 2020-07-07 13:42:07

Python swears at the if-elif construct. Where is the mistake?

age = int(input("Сколько вам лет?"))

if age < 100 :
    print("понятненько")

    elif
        print ("А?")

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
soremix, 2020-07-07
@memiss

1. Extra tabs
2. elif is not used without arguments. Either use else or pass an extra comparison
Either

age = int(input("Сколько вам лет?"))
if age < 100 :
    print("понятненько")
else:
    print ("А?")

Or
age = int(input("Сколько вам лет?"))
if age < 100 :
    print("понятненько")
elif age > 150:
    print ("А?")

A
Araya, 2020-07-07
@Araya

https://pythonworld.ru/osnovy/instrukciya-if-elif-...
Found in just 5 seconds

A
Alan Gibizov, 2020-07-07
@phaggi

age = int(input("Сколько вам лет?"))
if age < 100:
    print("понятненько")
else:
    print("А?")

extra tabs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question