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
g Consider a disk queue with requests for I/O to blocks on cylinders 95, 120, 41, 122, 15, 142, 65, 167. The Shortest Seek Time
yawa3891 [41]

Answer:

follows are the solution to the given question:

Explanation:

Please find the image file for the SSTF scheduling algorithm.

Following are the requested order:

Request \ \ order :\\\\95\\120\\122\\142\\167\\65\\ 41\\15

Calculating the Total Head Movement:

= (100-95) + (120-95) + (122-120) + (142-122) + (167-142) + (167-65) + (65-41) + (41-15)\\\\= 5 + 25 + 2 + 20 + 25 + 102 + 24 + 26\\\\= 229

6 0
3 years ago
What is the potential role of the computer in data storage, retrieval, and interpretation?
jonny [76]

Answer:

All data in a computer is stored as a number. The device is made up of a spinning disk (or disks) with magnetic coatings and heads that can both read and write information in the form of magnetic patterns. In addition to hard disk drives, floppy disks and tapes also store data magnetically.

Explanation:

5 0
3 years ago
Identify the careers that require a college degree
Vikentia [17]
Doctor or teacher or an engineer

8 0
3 years ago
Name 5 different vegetables that are going to waste due to coronavirus issues
Aleks04 [339]

Answer:

u can search that on google

Explanation:

7 0
3 years ago
Which of these improved the ability to send information over the network in the 1970s?
frez [133]

Answer:

b. ethernet

Explanation:

It was an ethernet that was developed in the 1970s that improved the ability to send the information over the network. It is the most widely used method to connect the computers in a LAN or the local area network, ever since 1980 when it was first introduced for commercial use. And it is being used in bulk even today.

4 0
3 years ago
Other questions:
  • Is a way of grading web pages by the number of other web pages that link to them?
    10·1 answer
  • Which layer of the osi model is mainly concerned with routing packets of data from one network card to another across a large ne
    9·1 answer
  • True or False
    14·2 answers
  • They convert energy from the Sun into usable chemical energy by the process of photosynthesis. They are
    11·1 answer
  • Which of the following is not a method of the history object?
    11·1 answer
  • What file name would allow you to easily find and edit your document later in Word Online?
    14·2 answers
  • | HELP PLS! C++ Sorting arrays can be performed using either Selection Sort or Insertion Sort or
    13·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    12·1 answer
  • How do mark somebody as brainliest??
    14·1 answer
  • Help!! me!! plsssssssssssssssssssssssssssssssssss
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!