0
Need explanation for simple program | assertion
the program is def a(x): x+=1 assert (x>=0),'negative' print(a(10)) output is: >>> None >>> but I expect out is < 11 > some one please explain how the out is came 'None' what is the meaning of 'None'
2 Answers
+ 3
None is same as null,Nil in other programming language.
In python function that doesn't return anything always returns None .
assert is used here to raise assertion error if x is less than 0 .
0
This function doesn't return any value. None is returned in such cases.
None represents absence of value.