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
Do opportunity costs only occur when making spending decisions
Naily [24]

Answer:

yes there is opportunity in every thing such as do i buy this car what am i going to miss out on if i buy this what does this offer

Explanation:

6 0
3 years ago
The negotiation process involves several steps such as: preparing for negotiation; knowing your walk-away point; and working tow
Rina8888 [55]

Answer:

TRUE

Explanation:

Negotiation may be defined as the process or a method with the help of which people try to settle their differences or they try to come to a conclusion in a matter of differences. Here an agreement or a compromise is reached without any dispute and arguments. It is a skill.

It involves preparing for the negotiation with other person, understanding and knowing when one needs to walk out of the negotiation process to avoid arguments and working towards the common goal of achieving an agreement.

Therefore, the answer is true.

6 0
3 years ago
Which one of the secondary storage types below would be best if you wanted to edit files and re-save them to secondary storage?
jenyasd209 [6]
USB drive
the cloud
google docs
google drive
7 0
3 years ago
Each TextField has a text property that's returned by its textProperty method as a StringProperty. The StringProperty method ___
masha68 [24]

Answer:

B: Bind

Explanation:

JavaFX property binding permits the synchronization of the value of two properties in such a way that whenever there is a change in one of the properties, there is an immediate update on the value of the other property. In this way, The StringProperty method bind receives an ObservableValue as an argument. When the ObservableValue changes, the bound property is updated accordingly.

4 0
3 years ago
Part of an algorithm which is repeated for fixed number of times is classified as.
AleksandrR [38]

The part of an algorithm which is repeated for a fixed number of times is classified as iteration.

Iteration is basically a repeated execution of the same set of instructions in sequence until a certain condition is met.  For loop is the type of iteration in which a block of instructions repeated again and again for the fixed number of times. Upon completion of the previous iteration, the next iteration starts. The iteration process stops only when the given termination condition matches.

For example, this is the syntax of for loop:

for(initialize; condition; increment);

for (int num=0; num<5; num++)

In this for loop, iteration is carried out for 5 times, starting the value of num from 0 and repeatedly iterates with an increment of one in num until the value of num is less than 5 i.e. 4. This loop terminates once the value of num becomes 5 and, in result the condition num < 5 fails to match anymore.

Therefore, the part of an algorithm which is repeated for fixed number of times is classfied as iteration.

You can learn more about itreation at

brainly.com/question/28134937

#SPJ4

7 0
1 year ago
Other questions:
  • Only the _________ can add users with passwords and limit user access to selected areas.
    5·1 answer
  • What are rules that we use on the internet called, and what are some of them?
    6·1 answer
  • Specification of database requirements falls under which category of database​ administration?
    8·1 answer
  • What is output by the following?<br><br>print (type("95"))
    13·1 answer
  • William has an internet connection that does not allow him to make calls when connected to the internet. what internet service c
    7·2 answers
  • Explain The Two Way Communication in full.
    10·1 answer
  • Guys i really need help pleasure?
    7·2 answers
  • Use the drop-down menus to match each description with the part of a report where it is located.
    10·1 answer
  • Look at the logos below, decide which one would be the most suitable to use for a Cooking App? Please explain your reason below.
    9·1 answer
  • A document that summarizes and displays data is called a: Group of answer choices Report Procedure Form Requirement
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!