Basic - 1
1. Import
import numpy as np
from six.moves import cPickle as pickle2. Multi-line statement
a = 1 + 2 + 3 + \
4 + 5 + 6 + \
7 + 8 + 9
a = 1; b = 2; c = 3
a = (1 + 2 + 3 +
4 + 5 + 6 +
7 + 8 + 9)3. __doc__
__doc__def double(num):
"""Function to double the value"""
return 2*num
>>> print(double.__doc__)
Function to double the value4. list, tuple, set, dictionary
list = ordered collections
tuple = immutable list
set = unordered, unique collections
dictionary = key-value pair
5. string format
Last updated
Was this helpful?