Text
from tabulate import tabulate
heading for each column
head = ["Package","Destination","Lodging","Transport","Price per head"]
assign data for 6 different packages
contents will be updated
variable name --> tab_data (table_data)
tab_data = [ ['1','Goa','Homestay','Van','20000'], ['2','Goa','Resort','Van','35000'], ['3','Manali','Homestay','Train','20000'], ['4','Manali','Resort','Train','40000'], ['5','Rajasthan','Homestay','Plane','35000'], ['6','Rajasthan','Resort','Plane','50000'] ] l1 = ['1','Goa','Homestay','Van','20000'] l2 = ['2','Goa','Resort','Van','35000'] l3 = ['3','Manali','Homestay','Train','20000'] l4 = ['4','Manali','Resort','Train','40000'] l5 = ['5','Rajasthan','Homestay','Plane','35000'] l6 = ['6','Rajasthan','Resort','Plane','50000']
p1 = 20000 p2 = 35000 p3 = 20000 p4 = 40000 p5 = 35000 p6 = 50000
welcome message
welc_msg = input("Welcome to Karnataka Tours & Travels! \nWe are offering exclusive packages for the following three destinations: Goa, Darjeeling and Rajasthan!\n" "These packages cover transport, lodging as well as give you an option for a tour guide. \n\nPress enter to book now!")
print()
print("Thank you for choosing Karnataka Tours and Travels!")
print()
input user budget
budget = float(input("Please enter your budget: "))
print()
displaying the table msg
print("Here is a list of the available packages:\n(NOTE:- The given price is applicable for one person, one night. \ Price of package will vary according to number of people and/or nights.")
print()
printing table
print(tabulate(tab_data, headers = head, tablefmt = 'grid'))
print()
print("Each additional night costs 7,000 \nEach additional person costs 10,000 \nDiscounts available for bookings above 60,000")
to input user choice for package no and calculate balance
print()
input no of nights
nights = int(input("Please enter no. of nights you intend to stay: "))
print()
input no of people
people = int(input("Please enter no. of people: "))
print()
input user choice for package number
choice = int(input("Enter the package no. you would like to proceed with (1/2/3/4/5/6): "))
while choice>0: if choice==1: price = p1 l = l1 choice = choice-1 elif choice==2: price = p2 l = l2 choice = choice-2 elif choice==3: price = p3 l = l3 choice = choice-3 elif choice==4: price_per_head = p4 l = l4 choice = choice-4 elif choice==5: price = p5 l = l5 choice = choice-5 elif choice==6: price = p6 l = l6 choice = choice-6 else: print("Please enter a valid choice.")
print()
to check balance
people_cost = 10000people nights_cost = 7000nights
additional_cost = people_cost + nights_cost
final_cost = price + additional_cost
user input for tour guide
tour_choice = input("Would you like to opt for a tour guide during your trip? (yes/no): ")
discount
if final_cost >= 60000: print ("A discount of 10% is available with your purchase.") final_cost = (0.9)*(final_cost)
print()
travelling with family
family = input("Are you travelling with family? (yes/no): ")
print()
family package discount
if family=='yes': fam_ch = input("Would you like to opt for the family package (5% off on current package)? [yes/no]:") if fam_ch=='yes': final_cost = (0.95)*(final_cost) print ("A discount of 5% has been applied to your package.")
print()
honeymoon
honeymoon = input("Going on a honeymoon with your loved one? (yes/no): ")
print()
honeymoon discount
if honeymoon=='yes': final_cost = (0.9)*(final_cost) print ("Congratulations! A discount of 10% has been applied to your package.")
print()
to check whether final cost exceeds budget or not
if final_cost>budget: print("Please chose a package within your budget.") print("Run the program again and kindly choose a different package within your budget range.")
else: print("You have chosen the following package:\n", l,"\n Your final cost is:", final_cost, "\n Thank you for choosing Karnataka Tours & Travels!! \n Please press enter to proceed to checkout." )
0 notes