Python. | Sololearn: Learn to code for FREE!

+2

Python.

here... 1. for i in range(5): 2. print("hello!") in line 1 for i in range(5): prints numbers from 0 to 4. and in line 2 i also know that print("hello") prints hello. but what i dont understand is how it prints hello five times. is it because the line 2 is indented

7/27/2017 6:25:31 PM

stephen haokip

2 Answers

New Answer

+6

because 0,1,2,3,4 are 5 numbers, since 0 also counts (:

+4

Becouse range is iterete numbers from 0 to 4, and cicle for do five iterations. Function print("hello!") in a body of a cicle, and calls five times.