Question
I am trying to add two lists together in python using a for loop.. My current code is message=input(Enter message to encode: ) myList=[] new_message=str.upper(message)
I am trying to add two lists together in python using a for loop..
My current code is
message=input("Enter message to encode: ")
myList=[] new_message=str.upper(message)
for ch in new_message: list=ord(ch) myList.append(list) print (myList) ##list1
key=input('Enter an integer for an encryption key: ')
keyList=[] #list2
#Seperates each number in "key" for ch in key: keyList.append(ch) #print(keyList) ## 1 4 5 63
#Changes ecryption key to integers integer_key=[int(z) for z in keyList] myList=[int(x) for x in myList] print(integer_key)
which displays the output:
Enter message to encode: This is so hard! [84, 72, 73, 83, 32, 73, 83, 32, 83, 79, 32, 72, 65, 82, 68, 33]
Enter an integer for an encryption key: 1249 [1, 2, 4, 9]
I want to use a for loop to add the lists together until the first list has no more values
essentially this:
[85,74,77,92,33,75,87.....etc]
any ideas!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started