Unit 2 Task 4 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 4: Counting even raffle tickets

← Back to task


One possible program:

count = 0

while True:
    num = int(input("Enter ticket number (-1 to stop): "))
    if num == -1:
        break
    if num % 2 == 0:
        count += 1

print("Even ticket numbers entered:", count)