Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ========== 01. Invert Values
- values = list(map(int, input().split(" ")))
- print([-x for x in values])
- # ========== 02. Multiples List
- factor = int(input())
- count = int(input())
- multiplies = [factor]
- for _ in range(1, count):
- multiplies.append(factor + multiplies[-1])
- print(multiplies)
- # ========== 03. Football Cards
- sequence_of_cards = input().split()
- total_players_team_a = 11
- total_players_team_b = 11
- removed_players_team_a = []
- removed_players_team_b = []
- game_is_terminated = False
- for given_card in sequence_of_cards:
- given_card = given_card.split("-")
- team = given_card[0]
- player = given_card[1]
- if team == "A":
- if player not in removed_players_team_a:
- total_players_team_a -= 1
- removed_players_team_a.append(player)
- elif team == "B":
- if player not in removed_players_team_b:
- total_players_team_b -= 1
- removed_players_team_b.append(player)
- if total_players_team_b < 7 or total_players_team_a < 7:
- game_is_terminated = True
- break
- print(f"Team A - {total_players_team_a}; Team B - {total_players_team_b}")
- if game_is_terminated:
- print("Game was terminated")
- # ========== 04. Number Beggars
- numbers_for_robbing = list(map(int, input().split(", ")))
- numbers_of_beggars = int(input())
- lst_beggars = [0] * numbers_of_beggars
- counter = 0
- for number in range(len(numbers_for_robbing)):
- lst_beggars[counter] += numbers_for_robbing[number]
- counter += 1
- if counter >= numbers_of_beggars:
- counter = 0
- print(lst_beggars)
- # ========== 05. Faro Shuffle
- deck_of_symbols = input().split()
- middle_of_deck = len(deck_of_symbols) // 2
- first_half_deck = deck_of_symbols[:middle_of_deck] # slicing in half
- second_half_deck = deck_of_symbols[middle_of_deck:] # slicing in half
- faro_shuffle_times = int(input())
- for shuffle in range(faro_shuffle_times):
- shuffled_deck = []
- for cards in range(middle_of_deck):
- shuffled_deck.append(first_half_deck[cards])
- shuffled_deck.append(second_half_deck[cards])
- first_half_deck = shuffled_deck[:middle_of_deck]
- second_half_deck = shuffled_deck[middle_of_deck:]
- print(shuffled_deck)
- # ========== 06. Survival of the Biggest
- lst_of_numbers = list(map(int, input().split()))
- numbers_to_remove = int(input())
- for num in range(numbers_to_remove):
- smallest = min(lst_of_numbers)
- lst_of_numbers.remove(smallest)
- print(", ".join(str(x) for x in lst_of_numbers))
- # ========== 07. Easter Gifts
- gifts = input().split()
- command = input()
- while command != "No Money":
- command = command.split()
- if command[0] == "OutOfStock":
- for gift in range(len(gifts)):
- if gifts[gift] == command[1]:
- gifts[gift] = "None"
- elif command[0] == "Required":
- if 0 < int(command[2]) < len(gifts):
- gifts[int(command[2])] = command[1]
- elif command[0] == "JustInCase":
- gifts[-1] = command[1]
- command = input()
- print(" ".join(x for x in gifts if x != "None"))
- # ========== 08. Seize the Fire
- type_of_fire = input().split("#")
- amount_of_water = int(input())
- cells_extinguished = []
- effort = 0
- for fire in type_of_fire:
- fire = fire.split(" = ")
- type_current_fire = fire[0]
- power_current_fire = int(fire[1])
- if power_current_fire <= amount_of_water:
- if type_current_fire == "High":
- if 81 <= power_current_fire <= 125:
- amount_of_water -= power_current_fire
- effort += power_current_fire * 0.25
- cells_extinguished.append(power_current_fire)
- elif type_current_fire == "Medium":
- if 51 <= power_current_fire <= 80:
- amount_of_water -= power_current_fire
- effort += power_current_fire * 0.25
- cells_extinguished.append(power_current_fire)
- elif type_current_fire == "Low":
- if 1 <= power_current_fire <= 50:
- amount_of_water -= power_current_fire
- effort += power_current_fire * 0.25
- cells_extinguished.append(power_current_fire)
- print("Cells:")
- for cell in cells_extinguished:
- print(f" - {cell}")
- print(f"Effort: {effort:.2f}")
- print(f"Total Fire: {sum(cells_extinguished)}")
- # ========== 09. Hello, France
- items_for_sale = input().split("|")
- budget = float(input())
- new_item_prices = []
- old_item_prices = []
- for item in items_for_sale:
- current_item = item.split("->")[0]
- price_item = float(item.split("->")[1])
- if current_item == "Clothes" and price_item <= 50:
- if budget >= price_item:
- budget -= price_item
- new_item_prices.append(price_item+(price_item*0.4))
- old_item_prices.append(price_item)
- elif current_item == "Shoes" and price_item <= 35:
- if budget >= price_item:
- budget -= price_item
- new_item_prices.append(price_item + (price_item * 0.4))
- old_item_prices.append(price_item)
- elif current_item == "Accessories" and price_item <= 20.50:
- if budget >= price_item:
- budget -= price_item
- new_item_prices.append(price_item + (price_item * 0.4))
- old_item_prices.append(price_item)
- profit = sum(new_item_prices) - sum(old_item_prices)
- print(" ".join(f"{x:.2f}" for x in new_item_prices))
- print(f"Profit: {profit:.2f}")
- if budget + sum(new_item_prices) >= 150:
- print("Hello, France!")
- else:
- print("Not enough money.")
- # ========== 10. Bread Factory
- working_events = input().split("|")
- energy = 100
- coins = 100
- gained_energy = 0
- bakery_open = True
- for day in working_events:
- event = day.split("-")[0]
- amount_of_event = int(day.split("-")[1])
- if event == "rest":
- energy += amount_of_event
- if energy <= 100:
- print(f"You gained {amount_of_event} energy.")
- print(f"Current energy: {energy}.")
- else:
- gained_energy = abs(amount_of_event - (energy - 100))
- if energy > 100:
- energy = 100
- print(f"You gained {gained_energy} energy.")
- print(f"Current energy: {energy}.")
- elif event == "order":
- if energy >= 30:
- energy -= 30
- coins += amount_of_event
- print(f"You earned {amount_of_event} coins.")
- else:
- print("You had to rest!")
- energy += 50
- if energy > 100:
- energy = 100
- else:
- if coins >= amount_of_event:
- coins -= amount_of_event
- print(f"You bought {event}.")
- else:
- print(f"Closed! Cannot afford {event}.")
- bakery_open = False
- break
- if bakery_open:
- print("Day completed!")
- print(f"Coins: {coins}")
- print(f"Energy: {energy}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement