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
When you think of computers, I want you to think:
jekas [21]

Answer:

Explanation:

When I think about computers, I can understand about the software and the hardware, we can touch the hardware, but the software don't because is only data stored in the hardware, we can interact with the stored data using the hardware, we can complete a system with data, software, hardware, and people, people try to learn about software because it is better paid than fix a hardware.

5 0
3 years ago
What is one similarity between compiled and interpreted programming languages? (5 points)
Rashid [163]

Answer:

Both compiled and interpreted languages are high-level languages and translate code for a computer to understand.

Explanation:

The one similarity between compiled and interpreted languages is that they are both high-level languages.

A high-level language is a computer language written in easy to understand human language which is then converted to machine code for the computer to understand.  

A high-level language can either be interpreted or compiled.

An interpreted is a language in which the code is translated line by line before execution while a compiled language is one in which the source code is converted directly into machine language before execution.

So, <u>the similarity between both languages is that they are high level languages and translate code for a computer to understand. </u>

8 0
2 years ago
For what reason can security risks never be fully eliminated?​
raketka [301]

Answer:

A vulnerability level of ZERO can never be obtained since all countermeasures have vulnerabilities themselves. For this reason, vulnerability can never be zero, and thus risk can never be totally eliminated.

Explanation:

also we need to be protected from scams and stuff

7 0
3 years ago
Python is an example of a low level programming language true or false?​
alekssr [168]
False- python is an example of a high level language. Other high levels are c++, PHP, and Java
6 0
3 years ago
What is one effective way for employees to keep their skill-sets current
natta225 [31]
Is it a multiple choice answer? if so would like to see the answers as there are TONS of effective ways and if i list one it may not be in that list you have if its multiple choice.
3 0
3 years ago
Other questions:
  • Cryptolocker is an example of what type of malware?
    11·1 answer
  • Bullets in a text box will do which of the following?
    9·1 answer
  • What are dividends? AA small part, or share, of a company. BA type of savings account that grows over time. CA distribution of a
    5·1 answer
  • Whats the best apex legend?
    5·2 answers
  • What date of us can be used on a desktop computer
    12·1 answer
  • Consider the following code segment.
    12·1 answer
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    13·1 answer
  • Write a program. in QBAsSIC
    13·1 answer
  • ¿Cuáles aspectos serían los que más incidirían para que no se pudiera cumplir con el principio de imparcialidad en una auditoría
    11·1 answer
  • Select each of the steps involved in creating a table in a presentation.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!