Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

codelab for python I have tried this and it is not working: s3= s1=s1[::-1] s2=s2[::-1] for i in range(len(s1)): s3+=s1[i]+s2[i] Given the strings s1 and

codelab for python

I have tried this and it is not working:

s3="" s1=s1[::-1] s2=s2[::-1] for i in range(len(s1)): s3+=s1[i]+s2[i]

Given the strings s1 and s2 that are of the same length, create a new string consisting of the last character of s1 followed by the last character of s2, followed by the second to last character of s1, followed by the second to last character of s2, and so on (in other words the new string should consist of alternating characters of the reverse of s1 and s2). For example, if s1 contained hello" and s2 contained"world", then the new string should contain "odlllreohw". Assign the new string to the variable s3.

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 Databases questions