Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

1 what does yellow colour on the map represent?

Answered: 1 week ago

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago