Advertisement
veronikaaa86

Conditional Statements - Python

Mar 6th, 2022
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. 01. Sum Seconds
  2.  
  3. first = int(input())
  4. second = int(input())
  5. third = int(input())
  6.  
  7. total_time = first + second + third
  8. minutes = total_time // 60
  9. seconds = total_time % 60
  10.  
  11. if seconds < 10:
  12. print(f'{minutes}:0{seconds}')
  13. else:
  14. print(f'{minutes}:{seconds}')
  15.  
  16. ===========================================================
  17. 02. Bonus Score
  18.  
  19. number = int(input())
  20.  
  21. bonus_points = 0
  22.  
  23. if number <= 100:
  24. bonus_points += 5
  25. elif number > 1000:
  26. bonus_points += number * 0.1
  27. else:
  28. bonus_points += number * 0.2
  29.  
  30. if number % 2 == 0:
  31. bonus_points += 1
  32. elif number % 10 == 5:
  33. bonus_points += 2
  34.  
  35. print(bonus_points)
  36. print(bonus_points + number)
  37.  
  38. ===========================================================
  39. 03. Time + 15 Minutes
  40.  
  41. hours = int(input())
  42. minutes = int(input())
  43.  
  44. minutes += 15
  45. if minutes > 59:
  46. hours += 1
  47. minutes -= 60
  48.  
  49. if hours > 23:
  50. hours = 0
  51.  
  52. if minutes < 10:
  53. print(f'{hours}:0{minutes}')
  54. else:
  55. print(f'{hours}:{minutes}')
  56.  
  57. ======================================================================================================================
  58.  
  59. 04. Toy Shop
  60.  
  61. trip_price = float(input())
  62. puzzles_number = int(input())
  63. dolls_number = int(input())
  64. bears_number = int(input())
  65. minions_number = int(input())
  66. trucks_number = int(input())
  67. price = puzzles_number * 2.6 + dolls_number * 3.0 + bears_number * 4.1 + minions_number * 8.2 + trucks_number * 2.0
  68. total_number = puzzles_number + dolls_number + bears_number + minions_number + trucks_number
  69.  
  70. if total_number >= 50:
  71. price_one = price - price * 0.25
  72. else:
  73. price_one = price
  74. total_price = price_one - price_one * 0.1
  75.  
  76. if trip_price <= total_price:
  77. print(f'Yes! {(total_price - trip_price):.2f} lv left.')
  78. else:
  79. print(f'Not enough money! {(trip_price - total_price):.2f} lv needed.')
  80.  
  81. ===========================================================
  82. 05. Godzilla vs. Kong
  83.  
  84. budget = float(input())
  85. count_statists = int(input())
  86. price_clothing_statist = float(input())
  87.  
  88. decor = 0.1 * budget
  89. clothes = count_statists * price_clothing_statist
  90.  
  91. if count_statists > 150:
  92. clothes = clothes - 0.10 *clothes
  93.  
  94. expenses = decor + clothes
  95.  
  96.  
  97. if budget >= expenses:
  98. print("Action!")
  99. money_left = budget - expenses
  100. print(f"Wingard starts filming with {money_left:.2f} leva left.")
  101. else:
  102. print("Not enough money!")
  103. money_needed = expenses - budget
  104. print(f"Wingard needs {money_needed:.2f} leva more.")
  105.  
  106. ===========================================================
  107. 06. World Swimming Record
  108.  
  109. record_in_seconds = float(input())
  110. distance = float(input())
  111. time = float(input())
  112.  
  113. total_time = distance * time
  114. delay = distance // 15 * 12.5
  115. total_time += delay
  116.  
  117. if total_time < record_in_seconds:
  118. print(f'Yes, he succeeded! The new world record is {total_time:.2f} seconds.')
  119. else:
  120. print(f'No, he failed! He was {total_time - record_in_seconds:.2f} seconds slower.')
  121.  
  122. ===========================================================
  123. 07. Shopping
  124.  
  125. budget = float(input())
  126. videocards = int(input())
  127. processors = int(input())
  128. ram_memories = int(input())
  129.  
  130. videocards_costs = videocards * 250
  131. processors_costs = processors * videocards_costs * 0.35
  132. ram_memories_costs = ram_memories * videocards_costs * 0.10
  133. all_costs = videocards_costs + processors_costs + ram_memories_costs
  134.  
  135. if videocards > processors:
  136. all_costs -= all_costs * 0.15
  137.  
  138. money_left = abs(budget - all_costs)
  139.  
  140. if all_costs <= budget:
  141. print(f'You have {money_left:.2f} leva left!')
  142. else:
  143. print(f'Not enough money! You need {money_left:.2f} leva more!')
  144.  
  145. ===========================================================
  146. 08. Lunch Break
  147.  
  148. import math
  149.  
  150. series = input()
  151. episode_duration = int(input())
  152. break_duration = int(input())
  153.  
  154. lunch_time = break_duration / 8
  155. relax_time = break_duration / 4
  156.  
  157. needed_time = lunch_time + relax_time + episode_duration
  158. rest_time = abs(break_duration - needed_time)
  159.  
  160. if needed_time <= break_duration:
  161. print(f'You have enough time to watch {series} and left with {math.ceil(rest_time)} minutes free time.')
  162. else:
  163. print(f"You don't have enough time to watch {series}, you need {math.ceil(rest_time)} more minutes.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement