substring = lambda s,start=0,end=len(s) : s[start:end]
print(substring("python",1))
I get an error saying s is not defined
NameError Traceback (most recent call last)
<ipython-input-18-7e4b2c9c6d67> in <module>()
----> 1 substring = lambda s,start=0,end=len(s) : s[start:end]
2 print(substring("python",1,3))
NameError: name 's' is not defined
I want to give the start and end as optional variables. How can I do it?