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.
Write a FOR loop that prints numbers from 1 to 5.
Use the range function.
Create a list of three fruits and iterate through it to print each fruit.
Think about how to access list elements in a loop.
What is the correct syntax for a FOR loop in Python?
Look for the keyword 'for' in the syntax.
True or False: The FOR loop can only iterate over numbers.
Recall that lists can contain various data types.
Create a program that accepts a user input list of names and prints them in alphabetical order using a FOR loop.
You need to sort the list before printing.
Write a FOR loop that generates the Fibonacci sequence up to a specified count and prints it.
Remember the classic Fibonacci definition where the next number is the sum of the two preceding ones.
5 more questions in this section. Enroll free to practise them all.
Enroll free