Post

💯
💯@__jemeel·
@Python_Dv Right answer A id = 5 is a global variable while id = 8 is a local variable that will only be called when getID function is called
English
0
0
0
163
R. Stephen Ruiz
R. Stephen Ruiz@rslruiz·
@Python_Dv a. ID:8 ID:5 """ getID() prints local var id -> 8; the print statement prints global var id -> 5 . """
English
0
0
0
173
Vivek Molkar
Vivek Molkar@vivekmolkar·
@Python_Dv Option a Explanation: getID defines id = 5 so creates a local variable. And it gets lost upon execution and is not available outside the function. So print stmt prints the global id value
English
0
0
0
198
Prem Prakash
Prem Prakash@4EverPrem·
@Python_Dv A. ID = 5 in first line is global variable while id = 3 in getID function is local. When print is called from inside getID function, it is going to print 8 and when it is called from outside the function, it prints 5
English
0
0
0
175
CodeToCompass
CodeToCompass@code2compass·
@Python_Dv Given a local variables one outside the function and one inside the function, the code first calls the function which checks for a local var and then print its value followed by the print function outside of the function
English
0
0
0
17
Paylaş