Given two strings and , return a new string that contains letters from these two strings "interwoven" together, starting with the first character of . If the two strings are not of equal length, then start looping "backward-and-forwards" in the shorter string until you come to the end of the longer string. We ask that you use while loops and keep them simple and precise.
def while_loops(string1: str, string2: str) -> str:
"""
Given two strings <string1> and <string2>, return a new string that contains letters from these two strings "interwoven" together, starting with the first character of <string1>. If the two strings are not of equal length, then start looping "backward-and-forwards" in the shorter string until you come to the end of the longer string. We ask that you use while loops and keep them simple and precise.
>>> while_loops("abcde","12")
'a1b2c1d2e1'
>>> while_loops("ab","123")
'a1b2a3'
>>> while_loops("abcdfe","123")
'a1b2c3d2f1e2'
>>> while_loops("c","ab")
'cacb'
"""
don't use any reverse or any other def do in on def while_loop, prove these doctests and write the code in python and don't add any import or any dictionaries or dictionary methods or any try-except statements
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images