Ana sayfa
/
Teknoloji
/
1 for i in ra nge (5): 2 prin t (i, end=''t') 1 012345 2 1234 3 12345 012345 01234

Soru

1 for i in ra nge (5):
2
prin t (i, end=''t')
1
012345
2
1234
3
12345
012345
01234

1 for i in ra nge (5): 2 prin t (i, end=''t') 1 012345 2 1234 3 12345 012345 01234

Çözüm

3.2314 Voting
avatar
Deniz
Profesyonel · 6 yıl öğretmeni
Uzman doğrulaması

Cevap

The given code is a Python script that prints numbers from 0 to 4. Here's the corrected version of the code:<br /><br />```python<br />for i in range(5):<br /> print(f'{i:02}', end=' ')<br />```<br /><br />Explanation:<br />- `for i in range(5):` creates a loop that iterates 5 times, with `i` taking values from 0 to 4.<br />- `print(f'{i:02}', end=' ')` prints the value of `i` formatted to have a width of 2 characters, with no newline character (`end=' '`) after each number.<br /><br />Output:<br />```<br />0 1 2 3 4<br />```
Derecelendirmek için tıklayın: