Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 06. String Pureness
- number = int(input())
- for string in range(number):
- word = input()
- if ',' in word or '.' in word or '_' in word:
- print(f'{word} is not pure!')
- else:
- print(f'{word} is pure.')
- 07. Double Char
- command = input()
- while command != "End":
- strings = command
- if strings == "SoftUni":
- command = input()
- continue
- result = ""
- for i in range(len(strings)):
- char = strings[i]
- result += char * 2
- print(result)
- command = input()
- 08. How Much Coffee Do You Need?
- command = input()
- coffee = 0
- while command != "END":
- events = command
- if events.lower() == "coding" or events.lower() == "dog" or events.lower() == "cat" or events.lower() == "movie":
- if events.islower():
- coffee += 1
- if events.isupper():
- coffee += 2
- else:
- pass
- command = input()
- if coffee <= 5:
- print(coffee)
- else:
- print("You need extra sleep")
- 09. Sorting Hat
- command = input()
- is_success = False
- while command != "Welcome!":
- name = command
- is_success = False
- if name == "Voldemort":
- print("You must not speak of that name!")
- break
- else:
- is_success = True
- 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.")
- else:
- print(f"{name} goes to Hufflepuff.")
- command = input()
- if is_success:
- print("Welcome to Hogwarts.")
- 10. Mutate Strings
- first_string = input()
- second_string = input()
- last_string = first_string
- for symbol in range(len(first_string)):
- left_part = second_string[:symbol + 1] # [0:symbol + 1:1]
- right_part = first_string[symbol + 1:] # [0:len(first_string):1]
- current_string = left_part + right_part
- if current_string == last_string:
- continue
- print(current_string)
- last_string = current_string
- 11. Easter Bread
- budget = float(input())
- kg_flour_price = float(input())
- one_pack_of_eggs_price = kg_flour_price * 0.75
- liter_milk = kg_flour_price + (kg_flour_price * 0.25)
- recipe = one_pack_of_eggs_price + kg_flour_price + (liter_milk * 0.250)
- colored_eggs = 0
- counter_breads = 0
- while budget > recipe:
- budget -= recipe
- colored_eggs += 3
- counter_breads += 1
- if counter_breads % 3 == 0:
- colored_eggs -= (counter_breads - 2)
- print(f"You made {counter_breads} loaves of Easter bread! Now you have {colored_eggs} eggs and {budget:.2f}BGN left.")
- 12. Christmas Spirit
- quantity = int(input())
- days = int(input())
- christmas_spirit = 0
- total_costs = 0
- condition_5_day = False
- for day in range(1, days + 1):
- condition_5_day = False
- if day % 11 == 0:
- quantity += 2
- if day % 2 == 0:
- christmas_spirit += 5
- total_costs += 2 * quantity
- if day % 3 == 0:
- christmas_spirit += 13
- total_costs += (5 * quantity) + (3 * quantity)
- condition_5_day = True
- if day % 5 == 0:
- christmas_spirit += 17
- total_costs += quantity * 15
- if condition_5_day:
- christmas_spirit += 30
- if day % 10 == 0:
- christmas_spirit -= 20
- total_costs += 23
- if day == days:
- christmas_spirit -= 30
- print(f'Total cost: {total_costs}')
- print(f'Total spirit: {christmas_spirit}')
Advertisement
Add Comment
Please, Sign In to add comment