0

What is the output of this code? Why?

x = 0 if “x” and True: x = “wrong” print(x) My choices to answer are: x, 0, wrong, NameError Gives me some different error. Why? Can anyone explain?

30th Nov 2018, 4:22 PM
Elis Belen
2 Answers
+ 4
Additionally to Maninder Singh, the string is wrapped in slanted double quotes, that's a problem too. Just use the regular double quotes.
30th Nov 2018, 4:59 PM
Ipang
+ 1
This code has indentation error in 3 line.it should be indent after if statement.
30th Nov 2018, 4:55 PM
Maninder $ingh
Maninder $ingh - avatar