What is the problem here | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is the problem here

while True: A=int(input("saisir un entier")) B=int(input("saisir un 2 entier")) if (10<=A<=60) and (10<=B<=60): break

25th Jan 2021, 9:08 AM
Ali Lahiani
Ali Lahiani - avatar
1 Resposta
+ 8
When using mutiple conditions, you have to hardcode each variable and use logical operators. if (10 <= A <= 60) # should be if (A >= 10 and A <= 60) Same with the second condition on variable "B". Because for example A is 70: if (10 <= 70 <= 60) if (1 <= 60) >> True The interpreter will run the condition left to right and it will first evaluate 10 <= 70 which is True so 1 (truthy). Then, 1 <= 60 is True though 70 in fact, is not between 10 and 60.
25th Jan 2021, 9:12 AM
noteve
noteve - avatar