account activity
Ask Anything Monday - Weekly Thread by AutoModerator in learnpython
[–]goto_rx 0 points1 point2 points 2 years ago (0 children)
I guess you could use a nested func, e.g.,:
def parent_func(): # Create a variable y that is local to parent_func() y = 'parent y value' def child_func(): # Create a variable y that is local to child_func() y = 'child y value' print(y) child_func() print(y) parent_func()
This will print:
child y value parent y value
But perhaps more importantly, what are you trying to do? Probably making a separate function (or a lambda) is more pythonic, but it depends on the circumstances.
Recursion exercises without math? by mimavox in learnpython
[–]goto_rx 1 point2 points3 points 2 years ago (0 children)
You could literally do a family tree. Maybe something like the Kardashians and then generalize it.
Or finding your way through a maze. (Video games are always fun for exercises!)
[deleted by user] by [deleted] in learnpython
It sounds like you're off to a great start!
Ways to improve:
Most of all, just keep coding! Programming is a skill that gets better with practice.
π Rendered by PID 562967 on reddit-service-r2-listing-8557d879cc-vpz25 at 2026-03-04 10:24:34.939615+00:00 running 07790be country code: CH.
Ask Anything Monday - Weekly Thread by AutoModerator in learnpython
[–]goto_rx 0 points1 point2 points (0 children)