-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locals project #5213
base: main
Are you sure you want to change the base?
Locals project #5213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @TectonicLion thank you for contributing to Codecademy docs, the entry is nicely written!
I've suggested a few changes, could you please review and modify them at your earliest convenience? Thank you! 😄
content/python/concepts/built-in-functions/terms/locals/locals.md
Outdated
Show resolved
Hide resolved
content/python/concepts/built-in-functions/terms/locals/locals.md
Outdated
Show resolved
Hide resolved
{'In': ['', 'locals()'], | ||
'Out': {}, | ||
'_': '', | ||
'__': '', | ||
'___': '', | ||
'__builtin__': , | ||
'__builtins__': , | ||
'__name__': '__main__', | ||
'_dh': ['/home/repl'], | ||
'_i': '', | ||
'_i1': 'locals()', | ||
'_ih': ['', 'locals()'], | ||
'_ii': '', | ||
'_iii': '', | ||
'_oh': {}, | ||
'_sh': , | ||
'exit': , | ||
'get_ipython': >, | ||
'quit': } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be converted to a working code? As this is not a correct code example. One example could be:
def my_function():
x = 10
y = 20
print("Local variables:", locals())
my_function()
This is just an example, feel free to modify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just an example. I wasn't sure what the actual result would be so I looked up the result elsewhere.
...Was I supposed to write out a function? I thought I was just supposed to show the result of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just an example. I wasn't sure what the actual result would be so I looked up the result elsewhere.
...Was I supposed to write out a function? I thought I was just supposed to show the result of the code.
Basically example section should have a code that gives an output, so this could be replaced with a code having locals
that gives an output
'quit': } | ||
``` | ||
|
||
Attempting to edit an active variable by changing `locals()` does not work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a ##Codebyte Example block at the end that will have the code for the term, the output showcasing does not follow it, just the code is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to bring up the only other use for locals() that I know of. Did I do it wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to bring up the only other use for locals() that I know of. Did I do it wrong?
No no, you just need to add one more code under a ##Codebyte Example block
Co-authored-by: Mamta Wardhani <[email protected]>
Co-authored-by: Mamta Wardhani <[email protected]>
Description
The `locals()' function returns a dictionary with all of the data necessary to run the program.
Issue Solved
Closes #5116
Type of Change
Checklist
(I did copy the example results from elsewhere, I wasn't sure where to get them myself. Is that alright?)
main
branch.Issues Solved
section.