Answer the question
In order to leave comments, you need to log in
Why nested if statements don't fire?
Hello. For luminaries, the question is elementary, but still:
The condition is a conceived number, only an if statement and two nested operators, two options - guessed (correctly) and not guessed (incorrectly)
For some reason nested operators do not work, please explain, please be so kind what is missing?
number = 43
guess = int(input('Введите число :'))
if guess == number:
if True:
print('Число выбрано верно')
if False:
print('Число выбрано неверно')
print('Завершено')
Answer the question
In order to leave comments, you need to log in
You misunderstand conditional statements a bit
if guess == number:
print('Число выбрано верно')
else:
print('Число выбрано неверно')
if True:
print('Число выбрано верно')
if False:
print('Число выбрано неверно')
You don't need more if for the current task.
if guess == number:
print('Число выбрано верно')
else:
print('Число выбрано не верно')
if guess == number:
print('Число выбрано верно')
elif guess == 0:
print('Нельзя ввести ноль')
else:
print('Число выбрано не верно')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question