Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
Write a for loop to print the numbers 0 to 3.
Use range to specify how many numbers to loop through.
Create a loop that prints each letter in 'Hello'.
Remember to iterate over the string directly.
What does the for loop do in Python?
Think about how you would use it to traverse a list of items.
True or False: The range function can only produce even numbers.
Consider how you can use the range to generate different sequences.
Write a function that uses a for loop to find the factorial of a number.
Remember that factorial means multiplying all integers from 1 to that number.
Create a reverse for loop that prints the numbers from 5 to 1.
Use the range function with a negative step value.
5 more questions in this section. Enroll free to practise them all.
Enroll free