正在加载视频...
视频加载失败
What is the output of following Python code?
64,935 次观看 • 2 年前 •via X (Twitter)
10 条评论

Indent error

Wow!. As soon as if condition is met, it will break out of remaining checks & print wow!. If order is changed x = 1 if x < 2: print('Wow again!') elif x == 1: print('Wow!') else: print('No wow!'), result is Wow again!for the reason explained earlier.

The correct answer would be 'A', as the execution of the if statement would occur and then immediately exit the if loop. Consequently, the answer is 'A'.

Indentation is important in Python.

If the indentation was correct, then it would print WOW, but like this, it gives an error. I had my experiences with that. :-D

B If x =1 And if x is less than 2 It would be B ( wow again) I’m only new so that’s my thinking

A. Wow! As in first condition met i.e x==1. So,the program ends there and the output is (Wow!)

A

IndentationError in Python world :)> Also in Python world with indentation A. Breaks w/ first TRUE.

A
