+ 1
why isnt awesomeinc_companies also listed in dir printed at last
(even though the condition given in func is true) https://code.sololearn.com/cDhpkeO1D6Lj/?ref=app
2 ответов
0
awesomeinc_companies is a local variable, that belongs to the function, and it only exists when the function is being run. Same case with the year variable, did you forget that it also doesn't exist in the dir() call ?
0
If you call print (dir ()) in the 2070 if statement, it will show awesome Inc and year in the list. Those are local to that block, and not to the entire script, or global scope.