Back to marketplace

Iteration

No description yet. This curated deck is ready for daily study.

Total cards: 2•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (2)

#1
Front (Question)

Count Controlled Iteration: - Ask the user to enter a number to count from 0 up to. - The program counts up to that number and stops at that number. - This means the code within the loop will execute this exact number of times:

Back (Answer)

• number = int(input(“Please enter a number to count up to - “)) • for i in range (0, number, 1): • print(i)

#2
Front (Question)

Condition Controlled Iteration: - We are asking the user to enter a test score between 0 and 50 for a test. - If the user enters anything outside of this range (e.g. -4, 51 etc.) then the program will repeat the code, requesting the user re-enter the score. - This code will repeat until the score entered meets the criteria of being between 0 and 50:

Back (Answer)

• score = 0 • score = int(input(“Enter a test score between 0 and 50 - “)) • while score < 0 or score > 50: • print(“Invalid score entered”) • score = int(input(“Enter a test score between 0 and 50 - “))