Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =========== 01. Integer Operations
- final_result = 0
- for integer in range(1, 4+1):
- num = int(input())
- if integer < 3:
- final_result += num
- elif integer == 3:
- final_result = final_result // num
- else:
- final_result *= num
- print(final_result)
- # =========== 02. Chars to String
- word = ""
- for _ in range(3):
- letter = input()
- word += letter
- print(word)
- # =========== 03. Elevator
- number_of_people = int(input())
- capacity_elevator = int(input())
- courses = 0
- for num in range(0, number_of_people, capacity_elevator):
- courses += 1
- print(courses)
- # =========== 04. Sum of Chars
- number_of_symbols = int(input())
- sum_of_symbols = 0
- for symbol in range(number_of_symbols):
- symbol_data = input()
- sum_of_symbols += ord(symbol_data)
- print(f"The sum equals: {sum_of_symbols}")
- # =========== 05. Print Part of the ASCII Table
- start_index = int(input())
- end_index = int(input())
- for ascii_symbol in range(start_index, end_index+1):
- print(chr(ascii_symbol), end=" ")
- # =========== 06. Triples of Latin Letters
- number_letters = int(input())
- end_range = 97 + number_letters
- for first_letter in range(97, end_range):
- for second_letter in range(97, end_range):
- for third_letter in range(97, end_range):
- print(f"{chr(first_letter)}{chr(second_letter)}{chr(third_letter)}")
- # =========== 07. Water Overflow
- tank_fullness = 0
- number_of_lines = int(input())
- for line in range(number_of_lines):
- water = int(input())
- if water <= 255 - tank_fullness:
- tank_fullness += water
- else:
- print("Insufficient capacity!")
- print(tank_fullness)
- # =========== 08. Party Profit*
- group_size = int(input())
- days_of_adventure = int(input())
- coins = 0
- for day in range(1, days_of_adventure + 1):
- if day % 10 == 0:
- group_size -= 2
- if day % 15 == 0:
- group_size += 5
- coins += 50 - (2 * group_size) # 50 profit - 2 for food per member
- if day % 3 == 0:
- coins -= 3 * group_size # spent for water
- if day % 5 == 0: # boss killing
- coins += 20 * group_size
- if day % 3 == 0: # if motivational party same day
- coins -= 2 * group_size
- print(f"{group_size} companions received {coins//group_size} coins each.")
- # =========== 09. Snowballs*
- snowballs_number = int(input())
- value_snowball = 0
- parameters_snowball = ""
- for snowball in range(snowballs_number):
- weight_snowball = int(input())
- time_to_target = int(input())
- quality_snowball = int(input())
- if (weight_snowball / time_to_target) ** quality_snowball > value_snowball:
- value_snowball = (weight_snowball / time_to_target) ** quality_snowball
- parameters_snowball = f"{weight_snowball} : {time_to_target} = {int(value_snowball)} ({quality_snowball})"
- print(parameters_snowball)
- # =========== 10. Gladiator Expenses*
- lost_fights = int(input())
- helmet_price = float(input())
- sword_price = float(input())
- shield_price = float(input())
- armor_price = float(input())
- shield_brake_times = 0
- expenses = 0
- for fight in range(1, lost_fights + 1):
- if fight % 2 == 0:
- expenses += helmet_price
- if fight % 3 == 0:
- expenses += sword_price
- if fight % 2 == 0:
- expenses += shield_price
- shield_brake_times += 1
- if shield_brake_times == 2:
- expenses += armor_price
- shield_brake_times = 0
- print(f"Gladiator expenses: {expenses:.2f} aureus")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement