Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
Use a for loop to print numbers from 1 to 10.
Use range with start and end values.
What is the output of the following code: for i in range(5): print(i)?
Think about the range function.
What does a for loop do?
Think about how loops operate in sequences.
True or False: A while loop runs indefinitely if the condition is always true.
Consider loop termination conditions.
Write a program that prints all prime numbers between 1 and 50 using a loop.
Consider checking divisibility for each number.
Create a while loop that prompts the user for input until they enter 'exit'.
Think about how the condition can end the loop.
5 more questions in this section. Enroll free to practise them all.
Enroll free