Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

What is the output of following Python code?

64,935 görüntüleme • 2 yıl önce •via X (Twitter)

10 Yorum

JobFocus Services profil fotoğrafı
JobFocus Services2 yıl önce

Indent error

Prem Prakash profil fotoğrafı
Prem Prakash2 yıl önce

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 profil fotoğrafı
CodingNerds COG2 yıl önce

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 profil fotoğrafı
Coffee N Code2 yıl önce

Indentation is important in Python.

.m0rph 👽 profil fotoğrafı
.m0rph 👽2 yıl önce

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 profil fotoğrafı
Robert Rees2 yıl önce

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 profil fotoğrafı
Gauresh Alai2 yıl önce

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

Rajnish🇮🇳 profil fotoğrafı
Rajnish🇮🇳2 yıl önce

A

Tomaz Kastrun (tomaz@fosstodon.org) profil fotoğrafı
Tomaz Kastrun ([email protected])2 yıl önce

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

Shibli Hasan profil fotoğrafı
Shibli Hasan2 yıl önce

A

Benzer Videolar