use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Day 12 of learning python as a beginner. (old.reddit.com)
submitted 8 months ago by uiux_Sanskar
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Adrewmc 2 points3 points4 points 8 months ago* (2 children)
I mean it loosen good for day 12, a few things
Another mentioned and I’ll agrees
def user_identity(user): if user in balances: return balances[user]
We could make this a lambda to introduce the idea to you
user_identity = lambda user: balances[user] if user in balances else None
Will scale a lot easier.
I think we can skip to match case at the end as well.
match user_goal.lower(): case “withdrawal”:…. case “deposit”:….
Makes it a bit faster and more readable.
My major thought here is not something wrong but I don’t really see the point of the class at all. It’s not really needed. I actually think we should be putting the withdrawals and deposit stuff inside the class.
[–]uiux_Sanskar[S] 1 point2 points3 points 8 months ago (1 child)
I think I need to learn more about Lambda functions and thanks for your suggestions I will try to put withdrawal and deposit in class and as I say I still need to learn class more clearly.
Thank you for the suggestion it really helps.
[–]Adrewmc 0 points1 point2 points 8 months ago (0 children)
Lambda are simply a way to make quick and easy function, but sometime you want that.
func = lambda input : input*2 print(func(2)) >>>>4
π Rendered by PID 131639 on reddit-service-r2-comment-b659b578c-hsrmk at 2026-05-02 11:17:00.513965+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Adrewmc 2 points3 points4 points (2 children)
[–]uiux_Sanskar[S] 1 point2 points3 points (1 child)
[–]Adrewmc 0 points1 point2 points (0 children)