def while_loops(string1: str, string2: str) -> str: """ 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 used 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' """ 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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

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 used 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'
"""

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

Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT