0
Anyone help me with this....?
def func(a): return zip(a,len(a)) b = map(func,input("Enter:").split(" ")) print(list(b))
5 ответов
+ 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!
+ 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
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
0
Or...if you wanna zip
c=list(zip(a:= input().split(" "),[len(b) for b in a]))
print(c)
0
Or
def func(a):
return list(zip([a],[len(a)]))
b = map(func,input("Enter:").split(" "))
print(list(b))