1/23/23, 10:00 AM1.2localhost:8888/nbconvert/html/Desktop/DATA WRANGLING/PYTHON/1.2 python for data science introduction/1.2.ipynb?download=false1/2
Input In [2] global = 1 ^SyntaxError: Input In [4] 21_abc12 =10 ^SyntaxError:
#Get all keywords in python 3.6
import
keywordprint(keyword
.
kwlist)print("Total number of keywords ", len(keyword
.
kwlist))
global
=
1abc12
=
10
#can't use special symbols as an identifier
21_abc12
=
10
1/23/23, 10:00 AM1.2localhost:8888/nbconvert/html/Desktop/DATA WRANGLING/PYTHON/1.2 python for data science introduction/1.2.ipynb?download=false2/2
Input In [6] a@ = 10 ^SyntaxError:
a
=
10;b
=
20;print("the value of a is {} and b is {} "
.
format(a,b))
a
@
=
10
1/23/23, 11:48 AM1_3localhost:8888/nbconvert/html/Desktop/DATA WRANGLING/PYTHON/1.2 python for data science introduction/1_3.ipynb?download=false1/3
#Print Hello, world to console
print("Hello, world 2")
#This is a long comment#and it extends #Multiple lines
"""This is also aperfect example ofmulti-line comments"""
def
double(num):
""" function to double the number """
return
2
*
num
1/23/23, 11:48 AM1_3localhost:8888/nbconvert/html/Desktop/DATA WRANGLING/PYTHON/1.2 python for data science introduction/1_3.ipynb?download=false2/3
print (double(10))
print (double
.
__doc__)
#Docstring is available to us as the attribute __doc__ of t
for
i
in
range(10):
print (i)
if
True
: print ("Machine Learning")
c
=
"AAIC"
if
True
: print ("Machine Learning"); c
=
"AAIC" a
=
1
#single statement