-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Refactored and Optimised Code base #1699
base: master
Are you sure you want to change the base?
Conversation
refactored master branch
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.
sum(d_cards)
is not evaluated. It should be evaluated and
Sum of both d_cards
& p_cards
should equal to 21
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.
yes.
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.
- Removing comments not a good idea as its not enhancing the code in any way unless
- One way to factor this block of code is to assign
input_str[-2]
to a variable, this way its more readable hence the comments are no longer needed 👍
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.
yes.
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.
match-case
is faster than if-else
. If you could do that instead of the if-else
match choice:
case "1":
...
case _:
...
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.
yes, @OfficialAhmed is right.
Match case are being introduced in not but recent version of python.
They are somewhat new in to this language.
else: | ||
continue |
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 be deleted
Optimized all code bases and refactored code.