We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please read the PEP 572 to see if your proposition is valid or not.
Describe the solution using the Walrus Operator To ensure that a value returned from a function is not none when used in your code.
nicknames = {"Bill":"Billy", "John":"Jim", "Theodore":"Ted"} nickname = nicknames.get("Amy") if nickname: print("The nickname is {nickname}") else: print("No nick name")
Describe alternatives you've used use the walrus operator to check in one line and keep the variable
nicknames = {"Bill":"Billy", "John":"Jim", "Theodore":"Ted"} if nickname := nicknames.get("Amy"): print("The nickname is {nickname}") else: print("No nick name")
Additional context no
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Please read the PEP 572 to see if your proposition is valid or not.
Describe the solution using the Walrus Operator
To ensure that a value returned from a function is not none when used in your code.
Describe alternatives you've used
use the walrus operator to check in one line and keep the variable
Additional context
no
The text was updated successfully, but these errors were encountered: