# Game: Predict answer based on 3 user inputs, 2 self created inputs

add9 = []

print(f"""
So,
""")


gives

Enter 1st 4-digit no.: 9999
The answer will be 2 and 999 and 7 = 29997
Enter 2nd 4-digit no.: 2345
The 3rd 4-digit is 9999 - 2345= 7654
Enter 4th 4-digit no.: 6789
The 5th 4-digit is 9999 - 7654= 3210

So,
9999+2345 = 12344
12344+7654 = 19998
19998+6789 = 26787
26787+3210 = 29997

[Program finished]


Code works fine. It's for kids to demo how to produce output using 3 inputs from user. The trick is to subtract 9999 from 2nd and 3rd input from user. I have tried to use as small syntax as possible.

Edit: 3rd and 5th digit are - 9999

Enter 1st 4-digit no.: 9990
The answer will be 2 and 999 and 8 = 29988
Enter 2nd 4-digit no.: 6667
The 3rd 4-digit is 9999 - 6667= 3332
Enter 4th 4-digit no.: 8888
The 5th 4-digit is 9999 - 3332= 1111

So,
9990+6667 = 16657
16657+3332 = 19989
19989+8888 = 28877
28877+1111 = 29988

[Program finished]


is working as expected

From calculator,

 Calculation 1
(1/1) 9,990. +
(1/2) 6,667. =
(1/3) 16,657. +
(1/4) 3,332. =
(1/5) 19,989. +
(1/6) 8,888. =
(1/7) 28,877. +
(1/8) 1,111. =
(1/9) 29,988.


• To start, I wouldn't put everything in a list. There are benefits to putting all five numbers in a sequence, but that needn't happen until the end
• You can expand your explanation for the "answer". First, it's unclear what you mean by "answer"; it's actually the fourth sum. Also, you can expand your explanation for each of the terms going into this fourth sum. Some of the notation I've shown is perhaps a little advanced for kids, so simplify it at your discretion.
• You should be replacing your expressions at the bottom with a loop.
• Where possible, you should be phrasing your operations as mathematical (mod, floor division) rather than string-based.
• I think you have an algorithmic problem? When I enter 9990 for the first number, the predicted and actual fourth sum diverge.

## Suggested

a = int(input("Enter 1st 4-digit no.: "))
sum4 = int(f'2{a//10}{(a - 2)%10}')
print(
f"The fourth sum will be the concatenation of:"
f"\n  2"
f"\n  ⌊{a}/10⌋ = {a//10}"
f"\n  mod({a} - 2, 10) = {(a - 2)%10}"
f"\n= {sum4}"
f"\n"
)

b = int(input("Enter 2nd 4-digit no.: "))
c = 9999 - b
print(f"The 3rd 4-digit no. is 9999 - {b} = {c}")

d = int(input("Enter 4th 4-digit no.: "))
e = 9999 - d
print(f"The 5th 4-digit no. is 9999 - {c} = {e}")

nums = (a, b, c, d, e)
print('\nSo,')
for i in range(4):
augend = nums[i+1]


## Output

Enter 1st 4-digit no.: 9999
The fourth sum will be the concatenation of:
2
⌊9999/10⌋ = 999
mod(9999 - 2, 10) = 7
= 29997

Enter 2nd 4-digit no.: 2345
The 3rd 4-digit no. is 9999 - 2345 = 7654
Enter 4th 4-digit no.: 6789
The 5th 4-digit no. is 9999 - 7654 = 3210

So,
9999 + 2345 = 12344
12344 + 7654 = 19998
19998 + 6789 = 26787
26787 + 3210 = 29997