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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!