Output of List
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
It will take less than 1 minute to register for lifetime. Bonus Tip - We don't send OTP to your email id Make Sure to use your own email id for free books and giveaways
Answers ( 3 )
The output concatenates the elements in list 1 with the elements in list 2 against the corresponding index number
ans=[]
for (i,j) in zip (list1,list2):
x=”.join([i,j])
ans.append(x)
ans
output: [‘sa’, ‘ra’, ‘an’, ‘sh’]
zip function makes a new list with each element as the elements of list1 and list2 “zipped” together.
The list comprehension will output [(‘s’,’a’),(‘r’,’a’),(‘a’,’n’,(‘s’,’h’)]
join function will “join” the 2 characters in each item together and the output would be [‘sa’, ‘ra’, ‘an’, ‘sh’]