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)
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))