0

Anyone help me with this....?

def func(a): return zip(a,len(a)) b = map(func,input("Enter:").split(" ")) print(list(b))

12th Jan 2022, 10:19 AM
Ravi King
5 Respuestas
+ 5
Ravi King , please give a complete description about the task that has to be done. if it is a code coach exercise, please mention the tutorial name and the lesson number. thanks!
12th Jan 2022, 11:26 AM
Lothar
Lothar - avatar
+ 1
1) use type annotation 2) what is `a`? Judging by context it must be iterable. 3) zip expects two iterables 4) len returns an integer not an iterable
12th Jan 2022, 10:24 AM
Harry
0
def func(a): return a,len(a) b = map(func,input("Enter:").split(" ")) print(list(b)) The mapper maps one element of your list
12th Jan 2022, 12:58 PM
Oma Falk
Oma Falk - avatar
0
Or...if you wanna zip c=list(zip(a:= input().split(" "),[len(b) for b in a])) print(c)
12th Jan 2022, 1:02 PM
Oma Falk
Oma Falk - avatar
0
Or def func(a): return list(zip([a],[len(a)])) b = map(func,input("Enter:").split(" ")) print(list(b))
12th Jan 2022, 1:07 PM
Oma Falk
Oma Falk - avatar