-1
I caught it in an exercise. in the code you need to have a number n between 0 and 100 and in the next lines a variable representing how much money each one has and be printed the minimum amount for each one to have 2000. Input ex: 2,999, 1050; output: 1001, 950. 2, 0, 2000; output: 2000. 1, 900; output: 1100. I can make him return the exit but only one. like: I can’t figure out the mistake, if you can help me...
n = 0
q = 0
d = 0
while 0 <= n <= 100:
n = int(input())
while d<2000:
d = int(input())
q = 2000-d
break
print(f'{q}')
And what is the meaning of this number
n
that you read right away? Note that you read and forget, do not use for anything.– anonimo
the n is the number of people, if the n is equal to two o d should receive two values, but I could not, I could only make him return 1
– slc19
Hello, @Luiza. The problem is only logical: 1 - you want to read the values of d before you do the calculation; 2 - write the answer... I’ll fix it here.
– William Teixeira
This post is relevant to problems of this type: What is the Table Test? How to apply
– Bacco