Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- day = int(input())
- hour = int(input())
- total = 0
- for i in range(1, day + 1):
- sums = 0
- for j in range(1, hour + 1):
- if i % 2 == 1:
- if j % 2 == 1:
- sums += 1
- else:
- sums += 1.25
- else:
- if j % 2 == 1:
- sums += 2.5
- else:
- sums += 1
- print(f"Day: {i} - {sums:.2f} leva")
- total += sums
- print(f"Total: {total:.2f} leva")
- РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
- day = int(input())
- hour = int(input())
- total = 0
- for i in range(1, day + 1):
- sums = 0
- for j in range(1, hour + 1):
- sums += (1 if j % 2 == 1 else 1.25) if i % 2 == 1 else (2.5 if j % 2 == 1 else 1)
- print(f"Day: {i} - {sums:.2f} leva")
- total += sums
- print(f"Total: {total:.2f} leva")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement