Загрузка видео...

Не удалось загрузить видео

На главную

What is the output of following Python code?

64,935 просмотров • 2 лет назад •via X (Twitter)

Комментарии: 10

Фото профиля JobFocus Services
JobFocus Services2 лет назад

Indent error

Фото профиля Prem Prakash
Prem Prakash2 лет назад

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.

Фото профиля CodingNerds COG
CodingNerds COG2 лет назад

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'.

Фото профиля Coffee N Code
Coffee N Code2 лет назад

Indentation is important in Python.

Фото профиля .m0rph 👽
.m0rph 👽2 лет назад

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

Фото профиля Robert Rees
Robert Rees2 лет назад

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

Фото профиля Gauresh Alai
Gauresh Alai2 лет назад

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

Фото профиля Rajnish🇮🇳
Rajnish🇮🇳2 лет назад

A

Фото профиля Tomaz Kastrun (tomaz@fosstodon.org)
Tomaz Kastrun ([email protected])2 лет назад

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

Фото профиля Shibli Hasan
Shibli Hasan2 лет назад

A

Похожие видео