Advertisement
trds

BMI

Nov 17th, 2020 (edited)
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.44 KB | None | 0 0
  1. bani=float(input("Cati bani aveti in portofel?"))
  2. if bani <100:
  3.     print ("Stati acasa!")
  4. else:
  5.     nume=input("Cum te cheama?")
  6.     greutatea=float(input("Introduceti greutatea"))
  7.     inaltimea=float(input("Introduceti inaltimea in metri"))
  8.     bmi=greutatea/(inaltimea*inaltimea)
  9.     tipPersoana=None
  10.     if bmi<18.5:
  11.         tipPersoana="slab"
  12.     elif bmi >=18.5 and bmi<25:
  13.          tipPersoana="normal"
  14.     elif bmi>=25 and bmi<30:
  15.          tipPersoana="supraponderal"
  16.     elif bmi >=30:
  17.         tipPersoana="obez"
  18.     print(tipPersoana)
  19.     paste=("paste", 0.5, 4, 23.7, 52.88, 3.7)
  20.     mere=("mere", 1, 3, 0.7, 13.81, 0.17)
  21.     carnePorc=("carne porc", 1, 20, 20.4, 0, 6.3)
  22.     lapte=("lapte", 1, 3.5, 33, 48, 35)
  23.     oua=("oua",0.1, 0, 7, 3.0, 11)
  24.     listaProduse=[paste, mere, carnePorc, lapte,oua]
  25.     if tipPersoana == "supraponderal":
  26.         for produs in listaProduse:
  27.             if produs [5] >=10:
  28.                 print("Nu cumpara:"+produs[0]+"!")
  29.             else:
  30.                 bani=bani-produs[2]
  31.                 if bani<=0:
  32.                     break
  33.     elif tipPersoana=="obez":
  34.         for produs in listaProduse:
  35.             if produs[5]>=10 or produs[4]>= 5:
  36.                 print("Nu cumpara:"+produs[0]+"!")
  37.             else:
  38.                 bani=bani-produs[2]
  39.                 if bani<=0:
  40.                     break
  41.     else:
  42.             print ("Poti cumpara orice!")
  43.     print("Mai ai" + str(bani) +"!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement