1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
posledela
4 years ago
13

For this portion of the lab you will design the solution so that you perform some conditional tests. For this lab: 1. You will v

alidate input to ensure that the user enters inputs within a certain range or larger than a certain minimum value. You will validate the inputs as follows: (LO 1, 2, 3) a. The user cannot enter a negative number for: i. Miles to kilometers ii. Gallons to liters iii. Pounds to kilograms iv. Inches to centimeters b. The user cannot enter a value above 1000 degrees for Fahrenheit to Celsius (LO1)c. You MUST design a logical program exit. You may NOT use exit, break, quit, or system exit, or ANY OTHER forced exit. Do not use a menu. Use LOGIC to exit the program. 2. If the user enters an invalid value, then the program will issue an error message and terminate immediately. (Do NOT accept further data).3. Save the program as firstname_lastname_Lab3a.py where you will replace firstname and lastname with your actual first and last name.4. Test all conditions prior to submitting.
Computers and Technology
1 answer:
PIT_PIT [208]4 years ago
4 0

Answer:

#Prompt the user to enter the miles.

Miles = float(input('Enter the miles to convert into kilometer: '))

#Check the miles.

if Miles >= 0 :

   #Convert the miles to kilometers.

   Miles_To_km = Miles*1.6

   #Display the result.

   print (Miles, "miles equivalent to", Miles_To_km, "kilometer.")

   #Prompt the user to enter the gallons.

   Gallon = float(input('Enter the gallons to convert into liter: '))

   #Check the validity of the Gallons entered.

   if Gallon >= 0:

       #Convert gallons into liters.

       Gal_To_Lit = Gallon*3.9

       #Display the result.

       print (Gallon, "gallons equivalent to", Gal_To_Lit, "liters.")

       #Prompt the user to enter the pounds.

       Pound = float(input('Enter the pounds to convert into kilograms: '))

       #Check the validity of the Pounds entered.

       if Pound >= 0:

           #Convert pounds into kilograms.

           Pounds_To_Kg = Pound*0.45

           #Display the result.

           print (Pound, "pounds equivalent to", Pounds_To_Kg, "kilograms.")

           #Prompt the user to enter the temperature in Fahrenheit.

           f = float(input('Enter the temperature in Fahrenheit: '))

           #Check the value to be not greater than 1000.

           if f < 1000:

               #Convert Fahrenheit into celsius.

               F_To_C = (f -32)*5/9

               #Display the result.

               print (f, "Fahrenheit equivalent to", F_To_C, "celsius.")

           #Otherwise.

           else:

               

               #Display the error message.

               print ("Invalid temperature (greater than 1000) !!!")

       else:

           #Display the error message.

           print ("Pounds cannot be negative !!!")

   else:

           #Display the error message.

           print ("Gallons cannot be negative !!!")

else:

   #Display the error message.

   print ("Miles cannot be negative !!!")

Explanation:

You might be interested in
Questions Presscomion
Alex787 [66]

Answer:

i dont get what you are trying to ask

Explanation:

7 0
3 years ago
What would happen if computers only had input peripherals and a CPU
Wewaii [24]
It will overheat because it don't have gpu
8 0
3 years ago
Read 2 more answers
Ites and days, on one of the slides in her school presentation. Which element can she use to
Lady_Fox [76]
<h2>Answer:</h2><h3>A text</h3><h3>or</h3><h3>C chart</h3>

8 0
3 years ago
Read 2 more answers
The information of an management information system comes from?
Debora [2.8K]

A management information system is a computer system consisting of hardware and software that serves as the backbone of an organization's operations

5 0
2 years ago
Different he launc.<br>in function are available with MS-Excel<br>Many​
Kruka [31]

functions are available with MS-Excel..

1.count and sum

2.cell references

3.data and Time

4.text

5.lookup and reference

6.finanical

7.round

8.array formula

7 0
3 years ago
Other questions:
  • Kendall receives an email stating that a leading computer company is giving away free computers, asking her to forward the email
    15·1 answer
  • Which statement best illustrates the relationship between three different
    12·1 answer
  • What is contrast (in Photography)?
    14·1 answer
  • You are given a 11-bit floating point representation with 1-sign bit, 3 bits for the exponent, and 7-bits for the mantissa. Expr
    9·1 answer
  • Katla is a project manager. One of the programmers on her team comes to her and says that he permanently deleted some code mista
    5·1 answer
  • WILL MARK BRAINILY!!
    9·2 answers
  • When a recipient responds to a meeting request, which statement most accurate descries what occurs?
    5·2 answers
  • Melissa is working on her Cell class by adding new methods. However, in her most recent version, she is receiving errors in some
    14·1 answer
  • Computer always produces wrong output true or false<br>​
    7·1 answer
  • What is the address space of a computer with a 64-bit address bus?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!