Advertisement
boyan1324

23401

Nov 13th, 2023
848
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.16 KB | None | 0 0
  1. #1
  2. number = int(input("Enter number: "))
  3. if number == 1:
  4.     print("Monday")
  5. elif number == 2:
  6.     print("Tuesday")
  7. elif number == 3:
  8.     print("Wednesday")
  9. elif number == 4:
  10.     print("Thursday")
  11. elif number == 5:
  12.     print("Friday")
  13. elif number == 6:
  14.     print("Saturday")
  15. elif number == 7:
  16.     print("Sunday")
  17. elif number > 7 or number < 1:
  18.     print("Invalid number")
  19.  
  20. #2
  21. day = input("Enter a day of the week: ")
  22. if day == "Monday":
  23.     print("Weekday")
  24. elif day == "Tuesday":
  25.     print("Weekday")
  26. elif day == "Wednesday":
  27.     print("Weekday")
  28. elif day == "Thursday":
  29.     print("Weekday")
  30. elif day == "Friday":
  31.     print("Weekday")
  32. elif day == "Saturday":
  33.     print("Weekend")
  34. elif day == "Sunday":
  35.     print("Weekend")
  36. else:
  37.     print("ERROR")
  38.  
  39. #3
  40. student = input("Enter the student's number: ")
  41. if student.startswith("23"):
  42.     print("1st course")
  43. elif student.startswith("22"):
  44.     print("2nd course")
  45. elif student.startswith("21"):
  46.     print("3rd course")
  47. elif student.startswith("20"):
  48.     print("4th course")
  49. elif student.startswith("19"):
  50.     print("5th course")
  51. else:
  52.     print("No such student")
  53.  
  54. #4
  55. age = int(input("Enter the person's age: "))
  56. gender = input("What gender is the person(only male/female): ")
  57.  
  58. if gender == "male":
  59.     if age < 16:
  60.         print("Master")
  61.     elif age >= 16:
  62.         print("Mr.")
  63. if gender == "female":
  64.     if age < 16:
  65.         print("Miss")
  66.     elif age >= 16:
  67.         print("Ms.")
  68.  
  69. #5
  70. place = input("Dormitory, School, or Bus-Station: ")
  71. product = input("What product: ")
  72. quantity = float(input("Quantity: "))
  73.  
  74. if place == "School":
  75.     if product.lower() == "coffee":
  76.         print(f"{(quantity * 0.50):.1f}")
  77.     elif product.lower() == "water":
  78.         print(f"{(quantity * 0.80):.1f}")
  79.     elif product.lower() == "beer":
  80.         print(f"{(quantity * 1.20):.1f}")
  81.     elif product.lower() == "sweets":
  82.         print(f"{(quantity * 1.45):.1f}")
  83.     elif product.lower() == "peanuts":
  84.         print(f"{(quantity * 1.60):.1f}")
  85.     else:
  86.         print("No such product")
  87. elif place == "Dormitory":
  88.     if product.lower() == "coffee":
  89.         print(f"{(quantity * 0.40):.1f}")
  90.     elif product.lower() == "water":
  91.         print(f"{(quantity * 0.70):.1f}")
  92.     elif product.lower() == "beer":
  93.         print(f"{(quantity * 1.15):.1f}")
  94.     elif product.lower() == "sweets":
  95.         print(f"{(quantity * 1.30):.1f}")
  96.     elif product.lower() == "peanuts":
  97.         print(f"{(quantity * 1.50):.1f}")
  98.     else:
  99.         print("No such product")
  100. elif place == "Bus-Station":
  101.     if product.lower() == "coffee":
  102.         print(f"{(quantity * 0.45):.1f}")
  103.     elif product.lower() == "water":
  104.         print(f"{(quantity * 0.70):.1f}")
  105.     elif product.lower() == "beer":
  106.         print(f"{(quantity * 1.10):.1f}")
  107.     elif product.lower() == "sweets":
  108.         print(f"{(quantity * 1.35):.1f}")
  109.     elif product.lower() == "peanuts":
  110.         print(f"{(quantity * 1.55):.1f}")
  111.     else:
  112.         print("No such product")
  113. else:
  114.     print("No such place")
  115.  
  116. #6
  117. num = int(input("Enter a number in range from -100 to 100: "))
  118. if -100 <= num <= 100 and num not in [-1, 0, 1]:
  119.     print("Yes")
  120. else:
  121.     print("No")
  122.  
  123. #7
  124. hour = int(input("Enter the hour: "))
  125. day = input("Enter the day of the week: ")
  126.  
  127. if day in ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]:
  128.     if hour in [1, 2, 3, 4, 5, 6, 13, 14, 18, 19, 20, 21, 22, 23, 24]:
  129.        print("closed")
  130.     elif hour in [7, 8, 9, 10, 11, 12, 15, 16, 17]:
  131.         print("open")
  132. elif day == "Sunday":
  133.     print("closed")
  134.  
  135. #8
  136. day = input("Enter the day for the ticket: ")
  137. if day == "Monday":
  138.     print(12)
  139. elif day == "Tuesday":
  140.     print(12)
  141. elif day == "Wednesday":
  142.     print(14)
  143. elif day == "Thursday":
  144.     print(14)
  145. elif day == "Friday":
  146.     print(12)
  147. elif day == "Saturday":
  148.     print(16)
  149. elif day == "Sunday":
  150.     print(16)
  151. else:
  152.     print("Unknown")
  153.  
  154. #9
  155. food = input("Enter the food: ")
  156. if food in ["tomato", "cucumber", "pepper", "carrot",]:
  157.     print("Vegetable")
  158. elif food in ["banana", "apple", "kiwi", "cherry", "lemon", "grapes"]:
  159.     print("Fruit")
  160. else:
  161.     print("Unknown")
  162.  
  163. #10
  164. number = int(input("Enter the number: "))
  165. if number > 200 or number < 100 and number % 2 != 0:
  166.     print("Invalid number")
  167. else:
  168.     print()
  169.  
  170. #11
  171. fruit = input("Enter the fruit you are going to buy: ")
  172. day = input("Enter the day: ")
  173. quantity = float(input("Enter the amount of fruits you are going to be buying: "))
  174.  
  175. if day in ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]:
  176.     if fruit == "banana":
  177.         print(f"{(quantity * 2.50):.2f}")
  178.     elif fruit == "apple":
  179.         print(f"{(quantity * 1.20):.2f}")
  180.     elif fruit == "orange":
  181.         print(f"{(quantity * 0.85):.2f}")
  182.     elif fruit == "grapefruit":
  183.         print(f"{(quantity * 1.45):.2f}")
  184.     elif fruit == "kiwi":
  185.         print(f"{(quantity * 2.70):.2f}")
  186.     elif fruit == "pineapple":
  187.         print(f"{(quantity * 5.50):.2f}")
  188.     elif fruit == "grapes":
  189.         print(f"{(quantity * 3.85):.2f}")
  190.     else:
  191.         print("error")
  192. elif day in ["Saturday", "Sunday"]:
  193.     if fruit == "banana":
  194.         print(f"{(quantity * 2.70):.2f}")
  195.     elif fruit == "apple":
  196.         print(f"{(quantity * 1.25):.2f}")
  197.     elif fruit == "orange":
  198.         print(f"{(quantity * 0.90):.2f}")
  199.     elif fruit == "grapefruit":
  200.         print(f"{(quantity * 1.60):.2f}")
  201.     elif fruit == "kiwi":
  202.         print(f"{(quantity * 3.00):.2f}")
  203.     elif fruit == "pineapple":
  204.         print(f"{(quantity * 5.60):.2f}")
  205.     elif fruit == "grapes":
  206.         print(f"{(quantity * 4.20):.2f}")
  207.     else:
  208.         print("error")
  209. else:
  210.     print("error")
  211.  
  212. #12
  213. city = input("Enter the city: ")
  214. volume_sells = float(input("Enter the volume of sells: "))
  215. if city == "Sofia":
  216.     if volume_sells >= 0 and volume_sells <= 500:
  217.         print(f"{(volume_sells * 5 / 100):.2f}")
  218.     elif volume_sells > 500 and volume_sells <= 1000:
  219.         print(f"{(volume_sells * 7 / 100):.2f}")
  220.     elif volume_sells > 1000 and volume_sells <= 10000:
  221.         print(f"{(volume_sells * 8 / 100):.2f}")
  222.     elif volume_sells > 10000:
  223.         print(f"{(volume_sells * 12 / 100):.2f}")
  224.     elif volume_sells < 0:
  225.         print("Error")
  226. elif city == "Varna":
  227.     if volume_sells >= 0 and volume_sells <= 500:
  228.         print(f"{(volume_sells * 4.5 / 100):.2f}")
  229.     elif volume_sells > 500 and volume_sells <= 1000:
  230.         print(f"{(volume_sells * 7.5 / 100):.2f}")
  231.     elif volume_sells > 1000 and volume_sells <= 10000:
  232.         print(f"{(volume_sells * 10 / 100):.2f}")
  233.     elif volume_sells > 10000:
  234.         print(f"{(volume_sells * 13 / 100):.2f}")
  235.     elif volume_sells < 0:
  236.         print("Error")
  237. elif city == "Plovdiv":
  238.     if volume_sells >= 0 and volume_sells <= 500:
  239.         print(f"{(volume_sells * 5.5 / 100):.2f}")
  240.     elif volume_sells > 500 and volume_sells <= 1000:
  241.         print(f"{(volume_sells * 8 / 100):.2f}")
  242.     elif volume_sells > 1000 and volume_sells <= 10000:
  243.         print(f"{(volume_sells * 12 / 100):.2f}")
  244.     elif volume_sells > 10000:
  245.         print(f"{(volume_sells * 14.5 / 100):.2f}")
  246.     elif volume_sells < 0:
  247.         print("Error")
  248. else:
  249.     print("Error")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement