• Python question of the day

    What would be the output of executing the following code:
    s1 = ['W', 'lo','Python']
    s2 = ['!', 've', 'e']
    print(" ".join(["".join([i, j]) for i, j in zip(s1, s2[::-1])]))
     We love Python!
     WelovePython!
     W! love Pythone
     TypeError
    Explanation:
    s2[::-1] gives ['e', 've', '!']
    zip(s1, s2[::-1]) gives [('W', 'e'), ('lo', 've'), ('Python', '!')]
    ["".join([i, j]) for i, j in zip(s1, s2[::-1])] gives ['We', 'love', 'Python!']
    " ".join(["".join([i, j]) for i, j in zip(s1, s2[::-1])]) gives We love Python!


    Top 100 python interview questions:


  • python bootcamp 2021
datai analytics