Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Miles to Kilometers miles = float ( input ( ' William , Please enter how many miles you want converted: ' ) ) #

# Miles to Kilometers
miles = float(input('William, Please enter how many miles you want converted: '))
# Check if miles is negative and if so end program.
if miles <0:
print('You can not enter a negative number goodbye, William.')
else:
milesToKilometers = miles *1.6
print('William,', miles, 'Miles is equal to Kilometers:', format(milesToKilometers,',.2f'), "isn't that amazing!")
Add a loop to the above program 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 condition apply : No use of
functions, list, a menu etc...break, quit, exit, sys.exit, return,
continue, or any other shortcut ion NEVER allowed.

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

Step: 3

blur-text-image

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 Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

4. EMC Corporation

Answered: 1 week ago

Question

6. Vanguard

Answered: 1 week ago