0

Hello everyone am new to python little help here

x=15 b=15 if x<b: print('ok'); else : print('notok'); #why output (notok) even if value are equal

14th May 2020, 1:02 AM
Hulk Smash
2 ответов
+ 2
It outputs "notok" because, well, x isn't less than b, it's equal to b. This causes the program to run the code inside the else statement. To prevent this from happening, try <= instead of <.
14th May 2020, 1:06 AM
Jianmin Chen
Jianmin Chen - avatar
+ 1
works thx 😊👍
14th May 2020, 1:09 AM
Hulk Smash