Commit e41753ef authored by SHRADDHEYA SHENDRE's avatar SHRADDHEYA SHENDRE

Adding task1.py (B1)

parents
def function1(str1,str2,olist):
l1 = len(str1)
l2 = len(str2)
l = min(l1,l2)
newlist = [(str1[x],str2[x]) for x in range(l)]
final = olist + newlist
return final;
list1 = ["H","E","L","L","O"]
pass1 = "Mathematician"
pass2 = "Cheerful"
returned = function1(pass1,pass2,list1)
print(list1)
print(returned)
# This is the one with for loops :
"""
def function1(str1,str2,olist):
l1 = len(str1)
l2 = len(str2)
l = min(l1,l2)
newlist = []
for x in range(len(olist)):
newlist.append(olist[x])
for x in range(l):
newlist.append((str1[x],str2[x]))
return newlist;
list1 = ["H","E","L","L","O"]
pass1 = "Mathematician"
pass2 = "Cheerful"
returned = function1(pass1,pass2,list1)
print(list1)
print(returned)
"""
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment