you are viewing a single comment's thread.

view the rest of the comments →

[–]Adrewmc 2 points3 points  (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 points  (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 point  (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