DIGIT-ARC read-only archive · snapshot: July 23, 2026

need help in python

2 posts · originally from https://geek.digit.in/community/threads/need-help-in-python.145480/

A
ankurankan Original post #1
Aug 23, 2011 at 6:58 PM
When I run the code:
>>>i=5
>>>def f(arg=i):
print(arg)

>>>i=6
>>>f()
It print 5.Why is this so??
Ishu Gupta
Aug 24, 2011 at 7:31 PM
In the second line, its read as def f(arg=5):.
If you use f(i), it'll print 6.
:?