Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Cipher Tool Method ?

1. ## Cipher Tool Method ?

Okay, so basically I'm trying to build a tool that will allow users to build ciphers using multiple different methods. I'm kinda stuck on the first one :P

Anyways:
I have it set up so that a for function [i] will run in range(in correspondence to the list caeserNumbers). These are then ran through individually and added onto based on variable sv. Basically, the formula for it would be 1 + sv = i. How would I make it so that the max possible value is 26, and then after that it restarts the process at 1 + sv?(I realize the code itself doesn't strictly state 1 + sv, but the for function does that). I've been messing around with this code for about 3 hours and tried the modulo operand but to no avail. I will italicize the specific code pertaining to the post.
Code:
```##-------> userFunctions_DEFINTIONS##
def Caeser(sv):
caeserLetters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
caeserList = {}
for ab in range(len(caeserLetters)):
caeserList[ab] = caeserLetters[ab]
print(caeserLetters[ab])
[I]caeserNumbers = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
caeserList = {}
for i in range(len(caeserNumbers)):
cipher = sv + caeserNumbers
print(i - sv)

#------------------------------------------------------------------------------->#

userFunctions = ["Caeser", "Number Skip", "Skip Letter", "Skip Word", "Cipher Builder"] ##user Commands
u_f = {} #Command Dump
for x in range(len(userFunctions)): ##loop through userFunctions
u_f[x] = userFunctions[x]
userInput = input("CipherBuild>") ##call for function
if userInput == u_f[0]:     ###CAESER##
print("Method Selected: " + str(u_f[0]))
CipherBuild>""")                                                                                ##input for skip variable
skipVariableInt = int(skipVariable) #making input readable for math
Caeser(skipVariableInt) #definition```

2. I see there was a BBCode error in my post in the code. That's fixed here.
Code:
```##-------> userFunctions_DEFINTIONS##
def Caeser(sv):
caeserLetters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
caeserList = {}
for ab in range(len(caeserLetters)):
caeserList[ab] = caeserLetters[ab]
print(caeserLetters[ab])
caeserNumbers = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
caeserList = {}
for i in range(len(caeserNumbers)):
cipher = sv + caeserNumbers
print(i - sv)

#------------------------------------------------------------------------------->#

userFunctions = ["Caeser", "Number Skip", "Skip Letter", "Skip Word", "Cipher Builder"] ##user Commands
u_f = {} #Command Dump
for x in range(len(userFunctions)): ##loop through userFunctions
u_f[x] = userFunctions[x]
userInput = input("CipherBuild>") ##call for function
if userInput == u_f[0]:     ###CAESER##
print("Method Selected: " + str(u_f[0]))
CipherBuild>""")                                                                                ##input for skip variable
skipVariableInt = int(skipVariable) #making input readable for math
Caeser(skipVariableInt) #definition```

3. I never tested this code myself but why not put a conditional statement in the for loop to check that whatever number you have is in the range 0 - 26 and if it's not reset the number.