In: Computer Science
USE PYTHON. Create a program that will ask a user to enter whole positive numbers. The program will use a while loop to let the program keep running. The user will be allowed to use the program as long as the quitVariable is equal to 'y' or 'Y'. When the user decides to quit playing, say "Thanks for playing!". The program will use a for loop to test if the number are even or odd. If even print "number is even", if odd print "odd". The loop will test 5 numbers.
All one program, so a for loop nested in a while loop I think.
quitVariable = 'y' while quitVariable == 'y' or quitVariable == 'Y': even_count = 0 odd_count = 0 for i in range(5): n = int(input("Enter a positive integer: ")) if n % 2 == 0: print("number is even") else: print("number is odd") quitVariable = input("Do you want to try again(y or n): ") print() print("Thanks for playing!")