print (' ')
print ('=================================')
print ('Options:')
print ('A.) Hello world ---> olHle dlWro')
print ('B.) Hello world ---> Hlelo Wlord')
while True:
#changes input to lowercase letters
sctype = input('Enter scramble type')
sclower = sctype.lower()
#if 'a' or 'b' not in sctype:
#print ('follow directions')
#input and input related variables
print ('There is a 26 character limit')
text = input(' Type your message or word: ')
length = len(text)
remaining = 26 - length
counter = 1
just a fancy cage for length and remaining
print ('============================')
print ('||Length:', length, 'Remaining:', remaining, '||')
print ('============================')
letter order and loop for option A dash replaces spaces in original text with dashes a fills in extra character space with spaces so length = 26 b scrambles a in the order it is given
if sclower == 'a':
print ('Results for option A')
print (' ')
dash = text.replace(" ", "-")
a = dash + ' ' * remaining
b = a[25] + a[0] + a[24] + a[1] + a[23] + a[2] + a[22] + a[3] + a[21] +
a[4] + a[20] + a[5] + a[19] + a[6] + a[18] + a[7] + a[17] + a[8] + a[16] +
a[9] + a[15] + a[10] + a[14] + a[11] + a[13] + a[12]
a = b
scrambles a the amount its original text length is
if a == b:
while counter <= length:
b = a[25] + a[0] + a[24] + a[1] + a[23] + a[2] + a[22] + a[3] +
a[21] + a[4] + a[20] + a[5] + a[19] + a[6] + a[18] + a[7] + a[17] + a[8] +
a[16] + a[9] + a[15] + a[10] + a[14] + a[11] + a[13] + a[12]
a = b
nospaces = b.replace(" ", "") #deletes all spaces made in var a
nodashes = nospaces.replace("-", " ") #changes all dashes to spaces
print (counter, '.)', nodashes)
counter += 1
print (' ')
option b
elif sclower == 'b':
print ('Results for option B')
print (' ')
dash = text.replace(" ", "-")
a = dash + ' ' * remaining
b = a[21] + a[23] + a[20] + a[25] + a[22] + a[24] + a[19] + a[2] + a[18] +
a[0] + a[16] + a[1] + a[17] + a[4] + a[15] + a[3] + a[14] + a[5] + a[13] +
a[7] + a[11] + a[6] + a[10] + a[9] + a[12] + a[18]
a = b
if a == b:
while counter <= length :
b = a[21] + a[23] + a[20] + a[25] + a[22] + a[24] + a[19] + a[2] +
a[18] + a[0] + a[16] + a[1] + a[17] + a[4] + a[15] + a[3] + a[14] + a[5] +
a[13] + a[7] + a[11] + a[6] + a[10] + a[9] + a[12] + a[18]
a = b
nospaces = b.replace(" ", "")
nodashes = nospaces.replace("-", " ")
print (counter, '.)', nodashes)
counter += 1
print (' ')
if input("Repeat the program? (Y/N)").strip().upper() != 'Y':
break
i need to impliment the code below into the code above. this will allow the program to scramble each word within a string individually instead of all at once
counter = 0
text = 'Hello World'
split = str.split(text)
for str in split:
no_name = split[counter]
scramble = c[4] + c[0] + c[3] + c[1] + c[2]
counter += 1
print (scramble, end=" ")
PLEASE NOTE: the variable "text" should allow user input in the final version, above is just an example of the structure