Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- points = 0
- p1 = 0
- p2 = 0
- p3 = 0
- p4 = 0
- p5 = 0
- invalids = 0
- for i in range(n):
- num = int(input())
- if num < 0 or num > 50:
- invalids += 1
- points /= 2
- elif 0 <= num <= 9:
- p1 += 1
- points += num * 0.2
- elif 10 <= num <= 19:
- p2 += 1
- points += num * 0.3
- elif 20 <= num <= 29:
- p3 += 1
- points += num * 0.4
- elif 30 <= num <= 39:
- p4 += 1
- points += 50
- elif 40 <= num <= 50:
- p5 += 1
- points += 100
- print(f"{points:.2f}")
- print(f"From 0 to 9: {((p1 / n) * 100):.2f}%")
- print(f"From 10 to 19: {((p2 / n) * 100):.2f}%")
- print(f"From 20 to 29: {((p3 / n) * 100):.2f}%")
- print(f"From 30 to 39: {((p4 / n) * 100):.2f}%")
- print(f"From 40 to 50: {((p5 / n) * 100):.2f}%")
- print(f"Invalid numbers: {((invalids / n) * 100):.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment