Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions projects/008-dog-years/python/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

human_y = int(input('Insert human years:'))

if 0 <= human_y <= 2: # condizione 1
dog_y = human_y * 10.5
print(f'{human_y} human years = {dog_y:.1f} dog years')
elif human_y > 2: # condizione 2 (else if)
dog_y = (human_y - 2) * 4 + 21
print(f'{human_y} human years = {dog_y:.1f} dog years')
else: # se nessuna condizione è rispettata
print('Negative values are not accepted')