Ana sayfa
/
Teknoloji
/
What is the output of the following code? for i in range (3): print(i) 0123 123 012 error

Soru

What is the output of the following code?
for i in range (3):
print(i)
0123
123
012
error

What is the output of the following code? for i in range (3): print(i) 0123 123 012 error

Çözüm

4.4200 Voting
avatar
Ramazan
Elit · 8 yıl öğretmeni
Uzman doğrulaması

Cevap

The output of the code is:<br />```<br />0<br />1<br />2<br />```<br />The `for` loop iterates over a range of numbers from 0 to 2 (since the upper limit is not specified, it defaults to the length of the range). In each iteration, the value of `i` is printed.
Derecelendirmek için tıklayın: