0
I’m trying to create a Python code that calculates the remaining value in my VR and alerts me if the average per day drops from 25. It is an attempt to better understand while and break.
I created a variable for the total value I receive and one for the current value, which is the total value minus an input that asks how much I spent today. When running the code, it seems that the value is being added to my total value rather than subtracted. Does anyone know where I went wrong?
PS: X = is the number of days counted in a month.
GASTODIA = int(input("Quanto você gastou hoje almoçando?"))
VRTOTAL = (35 * 30)
VRATUAL = (35 * 30) - (GASTODIA)
x = 1
MEDIARESTANTE = VRATUAL/(30 - x)
while MEDIARESTANTE > 25:
GASTODIA = int(input("Quanto você gastou hoje almoçando?"))
x = x + 1
MEDIARESTANTE = VRATUAL / (30 - x)
print("Você ainda tem " + str(MEDIARESTANTE) + " por dia para gastar.")
if MEDIARESTANTE < 25:
print("Pisa no freio, amigão, você só tem 25 reais por dia agora")
break
thank you very much, it helped a lot!
– Eduardo Mergener
You are welcome, Eduardo. If my answer has solved the problem, please accept it by clicking on check in below her grade.
– Rocchi