Answered step by step
Verified Expert Solution
Question
1 Approved Answer
# Miles to Kilometerss miles = float ( input ( ' enter how many miles you want converted: ' ) ) # Check if miles
# Miles to Kilometerss
miles floatinput enter how many miles you want converted:
# Check if miles is negative and if so end program.
if miles :
printYou can not enter a negative number goodbye, William.
else:
milesToKilometers miles
print miles, 'Miles is equal to Kilometers: formatmilesToKilometersf amazing!"
Need to modify the above program into the following :
Add a loop such that the user gets three chances to
enter a valid value. If the user enters an invalid value more than three times in a row, the program should issue an error message and terminate.
These conditions apply :
No use of functions, list, a menu break, quit, exit, sysexit, return,
continue, or any other shortcuts
Step 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