Last active
September 2, 2022 10:56
-
-
Save bryoussef-coder/02ee5cffd58debdb1a3324442d7d176e to your computer and use it in GitHub Desktop.
Python_YBR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## How do I define a function with optional arguments | |
Solved it with giving a value to the optional parameter as None: | |
def myFunc(arg1, arg2 = None): | |
#do stuff | |
if arg1 == "abc": #Extremely rare situation | |
# do sth with arg2 | |
## how do I convert a single digit number into a double digits string? | |
f"{a:02}" | |
## How to exit an if clause | |
def some_function(): | |
if condition_a: | |
# do something and return early | |
... | |
return | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment