Skip to content

Latest commit

 

History

History
47 lines (25 loc) · 863 Bytes

Triple_Trouble.md

File metadata and controls

47 lines (25 loc) · 863 Bytes

CodeWars Python Solutions


Triple Trouble

Create a function that will return a string that combines all of the letters of the three inputed strings in groups. Taking the first letter of all of the inputs and grouping them next to each other. Do this for every letter, see example below!

E.g. Input: "aa", "bb" , "cc" => Output: "abcabc"

Note: You can expect all of the inputs to be the same length.


Given Code

def triple_trouble(one, two, three):
    pass

Solution 1

def triple_trouble(one, two, three):
    return "".join([one[i]+two[i]+three[i] for i in range(len(one))])

Solution 2

def triple_trouble(one, two, three):
    return "".join(a+b+c for a,b,c in zip(one,two,three))

See on CodeWars.com