SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 305 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 09 Dec 2017 My Price 10.00

ValueError check into this finished Python Program?

Can someone help me add a ValueError check into this finished Python Program? I need it for when the user inputs the plane ticket price and how many bags they're checking out.

 

I'm not sure if this helps but I was told it should be something like this? Anyway I have attached the program that needs the error checking on.

 

while True:

   try:

       num1=int(input("Please enter a number:"))

       break

   except ValueError:

   print("Ooops! That was no valid number. Try again...")

 

   print("your number was",num1)

airport="Please follow the directions and type in your information."

 

 

print("Welcome to the Airport Kiosk.")

print("\n\n")

print(airport)

name=input("Please enter your First Name: ")

name2=input("Please enter your Last Name: ")

ticket=float(input("Please enter your plane ticket price: "))

bags=int(input("Please enter the amount of bags you are checking out: "))

 

if bags >=2:

    print ("\nYour first bag is free. Each additional bag is $25.")

    print ("There will be a charge of $",(bags-1)*25)

    totalprice=(ticket+(bags-1)*25)

    totalprice="%0.2f"%totalprice

    print("\n\nYour final amount will be",totalprice)

 

if bags <=1:

    print ("\n You will not have to pay a fee according to the amount of bags you entered.")

    ticket="%0.2f"%ticket

    print ("The total price of your flight will be",ticket)

print("Thank you",name,name2)

print("Please enter the payment option below.")

Answers

(5)
Status NEW Posted 09 Dec 2017 06:12 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)