Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 numbersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started