Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- group_numbers = int(input())
- musala = 0
- montBlanc = 0
- kilimanjaro = 0
- k2 = 0
- everest = 0
- alpinist_sum = 0
- for i in range(group_numbers):
- group_num = int(input())
- alpinist_sum += group_num
- if group_num > 40:
- everest += group_num
- elif group_num > 25:
- k2 += group_num
- elif group_num > 12:
- kilimanjaro += group_num
- elif group_num > 5:
- montBlanc += group_num
- elif group_num > 0:
- musala += group_num
- print(f'{musala / alpinist_sum * 100:.2f}%') #Или: for mountain in (musala, montBlanc, kilimanjaro, k2, everest):
- print(f'{montBlanc / alpinist_sum * 100:.2f}%') # print(f'{mountain / alpinist_sum * 100:.2f}%')
- print(f'{kilimanjaro / alpinist_sum * 100:.2f}%')
- print(f'{k2 / alpinist_sum * 100:.2f}%')
- print(f'{everest / alpinist_sum * 100:.2f}%')
- Фундаменталс решение:
- mountains = {'musala': 0, 'montBlanc': 0, 'kilimanjaro': 0, 'k2': 0, 'everest': 0}
- group_numbers = int(input())
- for i in range(group_numbers):
- group_num = int(input())
- destination = {group_num > 0: 'musala',
- group_num > 5: 'montBlanc',
- group_num > 12: 'kilimanjaro',
- group_num > 25: 'k2',
- group_num > 40: 'everest'}
- mountains[destination[True]] += group_num
- for mountain in mountains.values():
- print(f'{mountain / sum(mountains.values()) * 100:.2f}%')
Add Comment
Please, Sign In to add comment