For Loops

For loops are used to repeat a section of code a particular number of times.

Look at the example below and click on run:

In the code above, Range refers to the numbers of times you wish for the code to repeat.

 

We can also use a for loop to iterate over something such as a list or an integer in a variable

for example:

Try to write some code below to count from 0 to 10.

Add this to the trinket below. If you get really stuck, look here for a clue.

 

Posted in Uncategorized.

Leave a Reply

Your email address will not be published. Required fields are marked *


*