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
3 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]3 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
A7DF is the hexadecimal representation for what bit pattern?
kipiarov [429]

Answer:

1010 0111 1101 1111

Explanation:

A = 10 in decimal = 1010 in binary

7 = 7 in decimal = 0111 in binary

D = 13 in decimal = 1101 in binary

F = 15 in decimal = 1111 in binary

Therefore 0xA7DF = 1010 0111 1101 1111 in binary

6 0
3 years ago
A virus that propagates using the internet or another computer network is called __________.
olasank [31]
This is called a worm
8 0
2 years ago
____ are specially denoted text or graphics on a web page, that, when clicked, open a web page containing related content.
SIZIF [17.4K]
<span>Hyperlinks/links are specially denoted text or graphics on a web page, that, when clicked, open a web page containing related content</span>
5 0
3 years ago
Discuss different ways to respond to errors, such as notifying the user onscreen, writing to an error log, notifying the develop
Ronch [10]

Answer:

Notifying the errors is always useful .

Explanation:

The errors should always be notified to the developer. It is useful and is important. When we provide notifications on the screen, it helps the user and it can be used to provide feedback. In regard to developmental work, it has to be important and confidential and we use the help of email to inform or notify errors to the organization. This will help the company from negative criticism and helps the company perform better. We can also write an error log when we face the same error again and again even after notifying the developer organization. This helps to put a reminder to the organization that immediate check has to be dome and eliminate the error from the source.

Some disadvantages are if we do not keep timer implementation, the alert keeps on popping on the screen, which is irritable.

4 0
2 years ago
Which tab will you use to format data in cells?
kaheart [24]

Answer:

It's home tab

Explanation:

7 0
2 years ago
Read 2 more answers
Other questions:
  • Your colleague received an E-mail from a bank that is requesting credit card and PIN number information. Which of the following
    6·1 answer
  • Which of the following costs should be considered when providing your own Web server instead of using a cloud service provider o
    7·1 answer
  • What do developers do to support software products? explain to users which development process model was used to make the produc
    8·1 answer
  • Who all likes fortnite
    15·2 answers
  • Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and
    5·1 answer
  • When entering data in Access if the data is entered using an Access form, that data is stored in a table or tables. TRUE FALSE
    12·1 answer
  • List the difference between GIGO and bug ​
    15·1 answer
  • When converting text to a table, which feature should be used?
    12·1 answer
  • What is the standard unit used to measure mass?​
    9·1 answer
  • Linda wants to change the color of the SmartArt that she has used in her spreadsheet. To do so, she clicks on the shape in the S
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!