Advertisement
7f

codefixer-loadingdone1

7f
Sep 18th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. # Create holiday_camp procedure to print the camp name
  2. def holiday_camp():
  3. print("Tane's School Holiday Camp")
  4. print("These are the activities and costs")
  5. print("")
  6.  
  7. # Print the camp name at the start
  8. holiday_camp()
  9.  
  10. camp_details_list_tuple = [
  11. ("Cultural immersion", "easy", 800, "5"),
  12. ("Kayaking & pancakes", "moderate", 400, "3"),
  13. ("Mountain biking", "difficult", 900, "4")
  14. ]
  15.  
  16. # Loop through camp details and print them
  17. loop_count = 0
  18. while loop_count < len(camp_details_list_tuple):
  19. print(f"{loop_count} {camp_details_list_tuple[loop_count][0]} {camp_details_list_tuple[loop_count][3]} days {camp_details_list_tuple[loop_count][1]} {camp_details_list_tuple[loop_count][2]}")
  20. loop_count += 1
  21.  
  22. # Ask for name
  23. name = ""
  24. while name == "":
  25. name = input("What is your name? ")
  26. if name == "":
  27. print("Please enter your name - You cannot leave it blank.")
  28. print("")
  29.  
  30. # Ask for age
  31. age = 99
  32. while age < 5 or age > 17:
  33. if age != 99:
  34. print("Your age must be between 5 and 17 to attend the camp. Please enter a valid age")
  35. age = int(input("What is your age? "))
  36.  
  37. # Ask what camp the user wants to attend
  38. activity_number = int(input("What number camp do you want to go to? "))
  39.  
  40. # Ask what meal the user wants
  41. camp_meal = input("What meal do you want: standard, vegetarian, or vegan? ").lower()
  42.  
  43. # Ask if the user needs the shuttle bus
  44. shuttle_bus = 80
  45. shuttle_bus_question = input("Do you need the shuttle bus - extra $80? ").lower()
  46.  
  47. # Calculate total cost
  48. camp_cost = camp_details_list_tuple[activity_number][2]
  49. if shuttle_bus_question == "yes" or shuttle_bus_question == "y":
  50. total_cost = camp_cost + shuttle_bus
  51. else:
  52. total_cost = camp_cost
  53.  
  54. # Output confirmation
  55. print(f"Hello {name}, you are {age}. It lasts {camp_details_list_tuple[activity_number][3]} days, going to {camp_details_list_tuple[activity_number][0]} which is {camp_details_list_tuple[activity_number][1]}, your meal is {camp_meal}.")
  56. print(f"Please confirm you want to go with the cost of {total_cost}.")
  57. print("Enjoy the camp!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement