Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello..! I need help with this basic Python questions... Thank you in advance sir.. Q1 - Loops and Conditionals Ricky wants to encrypt a message

Hello..! I need help with this basic Python questions... Thank you in advance sir..

image text in transcribed
Q1 - Loops and Conditionals Ricky wants to encrypt a message to send to Lilia. Help him with this process - storing the encrypted message as a string in secret_message , using the specific approach to encryption described: 1. Starting with the third character in the message , take every third element and and add it to the output secret_message . Be sure to remove these characters from the original message in this process. (Reminder: there are helpful string methods; . replace( ) may help you here, but there are multiple ways to approach this, so your answer does not have to use .replace( ) .) 2. For all remaining characters in original message after step 1, reverse the order of these characters, such that the first character becomes the last and the second character becomes the second to last. Add this reversed string to the end of secret_mes sage . For example, for the message 'funtimes', secret_message would store 'nmseituf', where 'n', 'm' are the 3rd and 6th elements in the original string and 'seituf' is the remaining string ('futies') reversed, added onto the end of secret_message. Note: Avoid hard code. Use the code constructs taught in class. In other words, your code should have secret_message should store the correct output, even if the string in message were to change. if" you can test other 'message' strings # but be sure when you submit # message is 'todayis' message = 'todayis' U1Ilhh3l\\.lll In 01, you wrote code that would encrypt a message. Here, define a function called encrypt_message that will accomplish the same task as in Q1, taking a string as input and return ing the encrypted string from the function as specified in 02. This function should have a single parameter: input_message - the string to be modified

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

Students also viewed these Programming questions