MatteB_01

6.4 con sentinella

Nov 12th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. def assegnazione(reddito, figli):
  2.     reddito = int(reddito)
  3.     if reddito >= 30000 and reddito < 40000 and figli >= 3:
  4.         return(1000 * figli)
  5.     elif reddito >= 20000 and reddito < 30000 and figli  >= 2:
  6.         return(1500 * figli)
  7.     elif reddito < 20000:
  8.         return(2000 * figli)
  9.     else:
  10.         return("non idoneo all' assegnazione del sussidio")
  11.  
  12.  
  13. stop = False
  14. while not stop:
  15.     reddito = int(input("reddito (inserisci 1 per terminare il codice): "))
  16.     if reddito != 1:
  17.         numFigli = int(input("numero dei figli"))
  18.         print(f"il reddito da assegnare è {assegnazione(reddito, numFigli)}")
  19.         print("-" * 56)
  20.     else:
  21.         print("codice terminato")
  22.         stop = True
  23.  
Advertisement
Add Comment
Please, Sign In to add comment