Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def assegnazione(reddito, figli):
- reddito = int(reddito)
- if reddito >= 30000 and reddito < 40000 and figli >= 3:
- return(1000 * figli)
- elif reddito >= 20000 and reddito < 30000 and figli >= 2:
- return(1500 * figli)
- elif reddito < 20000:
- return(2000 * figli)
- else:
- return("non idoneo all' assegnazione del sussidio")
- def inputvalido(a):
- ok = False
- while not ok:
- output = input(f"inserire {a}: ")
- if output.isnumeric():
- return(int(output))
- else:
- print("input non valido")
- def finecodice():
- ok = False
- while not ok:
- output = input("vuoi continuare? [si/no]")
- if output.upper() == "SI":
- ok = True
- return False
- elif output.upper() == "NO":
- return True
- else:
- print("Non ho capito")
- stop = False
- while not stop:
- reddito = inputvalido("reddito")
- numFigli = inputvalido("numero dei figli")
- print(f"il reddito da assegnare è {assegnazione(reddito , numFigli)}")
- stop = finecodice()
- print("-" * 56)
Advertisement
Add Comment
Please, Sign In to add comment