+ 15

In what situation this code is used since nothing get printed and no errors

if not True: print("1")

20th Dec 2017, 8:45 AM
Nilavarasan
Nilavarasan  - avatar
3 Answers
+ 3
if the whole program consists of those 2 lines, then this code achieves nothing.
20th Dec 2017, 8:49 AM
storm
storm - avatar
+ 1
It is never printed because "not true" is not "true" in any case.
20th Dec 2017, 9:20 AM
BlazingMagpie
BlazingMagpie - avatar
+ 1
"not true" is same as false. That can be used in place of false. That not withstanding, you may prefer to use the false statement rather than "not true" since it takes lesser space
26th Jan 2018, 6:55 AM
LAWRENCE EHIMHEN
LAWRENCE EHIMHEN - avatar