Answered step by step
Verified Expert Solution
Link Copied!
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: #

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

Students explore these related Databases questions

Question

=+ Should the MNE belong (why, why not)?

Answered: 3 weeks ago