Python Forum

Full Version: Trying to create a python exe for an addition problem with an odd variable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good morning,
New to Python for sure, but I do have VERY limited experience with it. I am trying to write a short program that solves a short simple math problem with one oddball variable:

sample equation I am trying to code into a working .exe:

A random 4 digit code (i.e. 2491 in the example shown below) gets created, then the following needs to be programmed in:

Add 4 to first digit then add that result to the next digit in the code
If double digit, take 2nd digit (of that same #) and add to next digit in the code
Continue until last number, if last result is 2 digits, keep both of them:

2491

4+2 = 6
6 + 4 = 10
0+9 = 9
9+1 = 10 (end keeps both double digits)

60910


Trying to create a python program to use as exe to calculate this.

Here is all I can come up with so far

Code_1 = int(input("First Digit?"))
Code_2 = int(input("Second Digit?"))
Code_3 = int(input("Third Digit?"))
Code_4 = int(input("Fourth Digit?"))

Password_Code = Code_1, Code_2,Code_3,Code_4

print ("Your Remstar Code is", Password_Code)

I'm guessing it needs an IF statement with a regular expression to check for second number
If Regex for two digits matches, then grab first digit and save it type of thing,

This is where I am stuck!

Thanks!