What is the output of this code? Why? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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