Skip to content

Latest commit

 

History

History

01.4-loop-seventeen

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
tutorial

01.4 Loop from 1 to 17

To loop a specific number of times, we can use:

range(<start>,<end>)

In Python, range(x,y) returns a sequence of numbers starting with X, incrementing by 1 each time until it reaches the range.

For example:

for x in range(0,5):
    print(x)

Expected output:

0
1
2
3
4

Note that the number specified in range(), 5 in this example, is never reached and 4 is our last output.

We can incorporate additional parameters to further specify (now could be a good time to Google or at least check the HINT section 😉).

📝 Instructions:

  1. Count from 1 to 17 with a loop and print each number on the console.

💡 Hints:

💻 Expected result:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17