-1
X=[1,2,1,0,1]
def f(x):
     return {1:'car',2:'bike',0:'bus'}.get(x,'default')

for i in X:
    print(i)
    f(i)
output: 1 2 1 0 1 

The problem with the above code is, its not executing the function f(x)

gogaz
  • 2,323
  • 2
  • 23
  • 31
Durairaj s
  • 193
  • 3
  • 13

1 Answers1

3

What about this? It proves that it's executing normally

X=[1,2,1,0,1]
def f(x):
     return {1:'car',2:'bike',0:'bus'}.get(x,'default')

for i in X:
    print(i)
    print(f(i))
mohkamfer
  • 435
  • 3
  • 12