0
Trying to find totals to declining numbers...
I am trying to build a python code that adds a set number ‘example A = 1.5’ to a group for each day of the week. But each day the group gets slightly smaller by user pulling out random numbers, based on user input, so each day varies. At the end of the week I would like to know the total of the group left over and the amount of example A that was given in total.... Any amount of help would be appreciated 🙂
3 ответов
+ 1
n=int(input('Enter the constant number'))
Ans=n*7
for i in range(7):
print('Enter the number to be reduced on day',i+1)
x=int(input())
Ans-=x
print(Ans)
+ 1
The first line i am taking input of the constant that is added each day, so to get it for seven days, i have multiplied it by 7.
Now we take the seven inputs and reduce from the number.
0
Hi, thanks ill try that out. could you elaborate on what is going on in the code so i can understand please?
thank you!