I want to save the output of the line print(LettersUpC[CodeNum])
into a variable outside, but have it be a different variable each time. How can I accomplish this?
JavaScript
x
12
12
1
while 1 == 1:
2
CodeWord = str(input("Code-word: "))
3
Stop = ["Stop", "Exit", "End", "Terminate"]
4
if CodeWord in Stop:
5
exit("User Terminate")
6
while CodeNum < 55:
7
if CodeWord == CodeWordsUpC[CodeNum]:
8
print(LettersUpC[CodeNum])
9
break
10
else:
11
CodeNum = CodeNum + 1
12
Advertisement
Answer
this is a modified version that will work.
JavaScript
1
21
21
1
output = [":", ]
2
RTs = 0
3
InOrOut = str(input("Encode or Decode, E/D: "))
4
if InOrOut == "D":
5
while RTs < 9:
6
CodeNum = 0
7
CodeWord = str(input("Code-word: "))
8
Stop = ["Stop", "Exit", "End", "Terminate"]
9
if CodeWord in Stop:
10
break
11
while CodeNum < 55:
12
if CodeWord == CodeWordsUpC[CodeNum]:
13
output.append(LettersUpC[CodeNum])
14
break
15
else:
16
CodeNum = CodeNum + 1
17
RTs = RTs + 1
18
print(str(output[1] + output[2] + output[3]
19
+ output[4] + output[5] + output[6]
20
+ output[7] + output[8])) """This you might want to change to more depending on the amount of code-words you want to traselate"""
21