I'm currently working on a little project of mine and have encountered an error that I'm a little confused by. For this project I'm wanting to prompt the user for the number of people wanting to purchase a plane ticket, # of bags they would like to check in as well as their requested seat type.
Below you will find my code. I'm trying to display the user's total based on the number of tickets and what class they chose.
user_people = int(raw_input("Welcome to Ramirez Airlines! How many people will be flying?"))
user_seating = str(raw_input("Perfect! Now what type of seating would your party prefer?"))
user_luggage = int(raw_input("Thanks. Now for your luggage, how many bags would you like to check in?"))
user_frequent = str(raw_input("Got it. Is anyone in your party a frequent flyer with us?"))
user_continue = str(raw_input("Your reservation was submitted successfully. Would you like to do another?"))
import time
print time.strftime("Date and time confirmation: %Y-%m-%d %H:%M:%S")
if user_seating == economy:
seats_total = user_people * 916
print seats_total
elif user_seating == business:
seats_total = user_people * 2650
print seats_total
else:
seats_total == user_people * 5103
print seats_total
This is the error I am receiving:
Traceback (most recent call last):
File "C:/Users/Cory/Desktop/Project 1.py", line 11, in <module>
if user_seating == economy:
NameError: name 'economy' is not defined
I'm currently using Python 2.7.9 and raw_input() should be the correct command, right? I'm aware that input is used in 3.4
So, what exactly am I not understanding? I also have to put the entire billing code in a while loop so after a reservation is made I ask the user if he/she would like to create another one. If yes, then it loops, and if not; it terminates. I have a little understanding of the best way to do that (it would be around the entire code, no?)
Thanks all!
Aucun commentaire:
Enregistrer un commentaire