Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = int(input())
- result = 0
- num0To10 = 0
- num10To20 = 0
- num20To30 = 0
- num30To40 = 0
- num40To50 = 0
- invalid_num = 0
- for i in range(num):
- number = float(input())
- if 0 <= number < 10:
- result += number * 0.2
- num0To10 += 1
- elif 10 <= number < 20:
- result += number * 0.3
- num10To20 += 1
- elif 20 <= number < 30:
- result += number * 0.4
- num20To30 += 1
- elif 30 <= number < 40:
- result += 50
- num30To40 += 1
- elif 40 <= number <= 50:
- result += 100
- num40To50 += 1
- else:
- result /= 2
- invalid_num += 1
- print(f'{result:.2f}')
- print(f'From 0 to 9: {num0To10 / num * 100:.2f}%')
- print(f'From 10 to 19: {num10To20 / num * 100:.2f}%')
- print(f'From 20 to 29: {num20To30 / num * 100:.2f}%')
- print(f'From 30 to 39: {num30To40 / num * 100:.2f}%')
- print(f'From 40 to 50: {num40To50 / num * 100:.2f}%')
- print(f'Invalid numbers: {invalid_num / num * 100:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement