Skip to content

Instantly share code, notes, and snippets.

@adammbalogh
Last active August 29, 2015 14:11
Show Gist options
  • Save adammbalogh/3a6ad03cbaedc7b6c7ae to your computer and use it in GitHub Desktop.
Save adammbalogh/3a6ad03cbaedc7b6c7ae to your computer and use it in GitHub Desktop.
a = None
a is not None # False
t = (1, 2, 3)
2 in t # True
a = 10
7 < a <= 10 # True
def is_float_equal(a, b):
return abs(a - b) <= sys.float_info.epsilon
blank_str = ' ' * 9 # ' '
"Hello {name}".format(name="Adam") # Hello Adam
b = 'lesser' if 5 < 6 else 'greater' # 'lesser'
a_list = [1 for x in range(5)] # [1, 1, 1, 1, 1]
def setup(*, param1=1, param2=2): # you have to call this method with key-value params or withouth any params
pass
params = dict(param1=5, param2=6)
setup(**params)
def print_args(*args, **kwargs): # args are simple params, kwargs are dictionary params
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment