Python Forum
Trying to create a python exe for an addition problem with an odd variable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to create a python exe for an addition problem with an odd variable
#1
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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to create a variable only for use inside the scope of a while loop? Radical 10 1,711 Nov-07-2023, 09:49 AM
Last Post: buran
  dynamic variable name declaration in OOP style project problem jacksfrustration 3 786 Oct-22-2023, 10:05 PM
Last Post: deanhystad
  problem in using pyqrcode module to create QRcode akbarza 9 1,958 Aug-23-2023, 04:17 PM
Last Post: snippsat
  Multiply and Addition in the same loop statement with logic. joelraj 2 1,039 Feb-02-2023, 04:33 AM
Last Post: deanhystad
  loop (create variable where name is dependent on another variable) brianhclo 1 1,140 Aug-05-2022, 07:46 AM
Last Post: bowlofred
  forloop to compute sum by alternating from addition to subtraction JulianZ 3 1,815 Apr-02-2022, 09:36 AM
Last Post: DeaD_EyE
  problem with pyinstaller to create an executable file atlass218 0 2,569 May-15-2021, 11:01 AM
Last Post: atlass218
  Create variable and list dynamically quest_ 12 4,404 Jan-26-2021, 07:14 PM
Last Post: quest_
  How do I get the in3.Client() to create a variable with attributes? (in3 pypi pckge) Johno 2 1,859 Jan-21-2021, 02:49 AM
Last Post: Johno
  Create new variable dependent on two existing variables JoeOpdenaker 6 3,020 Oct-25-2020, 02:15 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020