Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 01. Jenny's Secret Message
- def hello(name):
- if name != "Johnny":
- print(f"Hello, {name}!")
- else:
- print(f"Hello, my love!")
- hello(input())
- # 02. Drink Something
- age = int(input())
- if age <= 14:
- print("drink toddy")
- elif age <= 18:
- print("drink coke")
- elif age <= 21:
- print("drink beer")
- elif age > 21:
- print("drink whisky")
- # 03. Chat Codes
- number_lines = int(input())
- for line in range(number_lines):
- message = int(input())
- if message == 88:
- print("Hello")
- elif message == 86:
- print("How are you?")
- elif message < 88:
- print("GREAT!")
- else:
- print("Bye.")
- # 04. Maximum Multiple
- divisor = int(input())
- bound = int(input())
- max_num = 0
- for num in range(1, bound+1):
- if num % divisor == 0:
- max_num = num
- print(max_num)
- # 05. Orders
- number_orders = int(input())
- total_price = 0
- for orders in range(number_orders):
- price_capsule = float(input())
- days = int(input())
- capsules_per_day = int(input())
- rules = [0.01 <= price_capsule <= 100, 1 <= days <= 31,
- 1 <= capsules_per_day <= 2000]
- if not all(rules):
- continue
- current_price = (days * capsules_per_day) * price_capsule
- total_price += current_price
- print(f"The price for the coffee is: ${current_price:.2f}")
- print(f"Total: ${total_price:.2f}")
- # 06. String Pureness
- number_of_strings = int(input())
- non_pure_symbols = [".", ",", "_"]
- pureness = True
- for string in range(number_of_strings):
- data_check = input()
- for symbol in non_pure_symbols:
- if symbol in data_check:
- pureness = False
- if pureness:
- print(f"{data_check} is pure.")
- else:
- print(f"{data_check} is not pure!")
- pureness = True
- # 07. 07. Double Char
- receive_data = input()
- new_word = ""
- while receive_data != "End":
- if receive_data != "SoftUni":
- for letter in receive_data:
- new_word += letter+letter
- print(new_word)
- receive_data = input()
- new_word = ""
- # 08. How Much Coffee Do You Need?
- awake_info = input()
- coffee_cups = 0
- while awake_info != "END":
- if awake_info in ["cat", "dog", "movie", "coding"]:
- coffee_cups += 1
- elif awake_info in ["CAT", "DOG", "MOVIE", "CODING"]:
- coffee_cups += 2
- awake_info = input()
- if coffee_cups > 5:
- print("You need extra sleep")
- else:
- print(coffee_cups)
- # 09. Sorting Hat
- name = input()
- while name != "Welcome!":
- if name == "Voldemort":
- print("You must not speak of that name!")
- break
- if len(name) < 5:
- print(f"{name} goes to Gryffindor.")
- elif len(name) == 5:
- print(f"{name} goes to Slytherin.")
- elif len(name) == 6:
- print(f"{name} goes to Ravenclaw.")
- elif len(name) > 6:
- print(f"{name} goes to Hufflepuff.")
- name = input()
- if name == "Welcome!":
- print("Welcome to Hogwarts.")
- # 10. Mutate Strings
- first_word = input()
- second_word = input()
- already_mutated = [first_word]
- mutated_word = ""
- for letter in range(len(first_word)):
- mutated_word = second_word[:letter+1]+first_word[letter+1:]
- if mutated_word not in already_mutated:
- print(mutated_word)
- already_mutated.append(mutated_word)
- # 11.Easter Bread
- cooking_budget = float(input())
- price_for_flour = float(input())
- price_one_pack_eggs = price_for_flour * 0.75
- milk_liter_price = (price_for_flour * 0.25) + price_for_flour
- one_bread_price = price_one_pack_eggs + price_for_flour + (milk_liter_price*0.25)
- loaves = cooking_budget // one_bread_price
- colored_eggs = 0
- for count in range(1, int(loaves) +1):
- colored_eggs += 3
- if count % 3 == 0:
- colored_eggs -= count - 2
- print(f"You made {int(loaves)} loaves of Easter bread! Now you have {colored_eggs} eggs and "
- f"{cooking_budget - (loaves * one_bread_price):.2f}BGN left.")
- # 12.Christmast Spirit
- quantity_of_decorations = int(input())
- days_till_christmas = int(input())
- christmas_spirit = 0
- shopping_costs = 0
- for day in range(1, days_till_christmas +1):
- if day % 11 == 0:
- quantity_of_decorations += 2
- if day % 2 == 0:
- shopping_costs += 2 * quantity_of_decorations
- christmas_spirit += 5
- if day % 3 == 0:
- shopping_costs += 8 * quantity_of_decorations
- christmas_spirit += 13
- if day % 5 == 0:
- shopping_costs += 15 * quantity_of_decorations
- christmas_spirit += 17
- if day % 3 == 0:
- christmas_spirit += 30
- if day % 10 == 0:
- shopping_costs += 23
- christmas_spirit -= 20
- if days_till_christmas == day:
- christmas_spirit -= 30
- print(f"Total cost: {shopping_costs}")
- print(f"Total spirit: {christmas_spirit}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement