Question: in python Conditional loops repeat as long as - or until -- some condition is true. The following programming example illustrates how they work: #

 in python Conditional loops repeat as long as - or until

-- some condition is true. The following programming example illustrates how they

in python

Conditional loops repeat as long as - or until -- some condition is true. The following programming example illustrates how they work: # A Name Guessing Game similar to the Magic Number game # The name that we are guessing name = "George" # Get the first guess and set numGuesses accordingly guess = input("What\'s my name?") numGuesses = 1 Repeat as long as your guess is wrong while guess != name : numGuesses = numGuesses + 1 print("No, it isn\'t " guess, " but try again.") guess = input("What\'s my name?") # The player is finally right print("YES! It IS", name) Print("It took you."numGuesses, guesses.") You are going to write a program that prints the first five numbers that are divisible by 7 and whose last digit is a 5. You will need to use a conditional loop and you will test each number starting from 1 to see if it is divisible by 7 (x % 7 ==0) and if the last digit is a 5 (x %10 ==5). Print each of these numbers. Keep a count of how many such numbers you find, because you will stop when you have found five such numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!