26 Sep 2022 Funvtion Incomplete - Jupyter Notebook
26 Sep 2022 Funvtion Incomplete - Jupyter Notebook
26 Sep 2022 Funvtion Incomplete - Jupyter Notebook
# Lamda Function
#Modules: They are the .py extension files that contain python codes defining functions.
classes, variables etc.,
#with a suffix .py appended in the file name
#They can have different functions, variables, classes etc in one file.
#Also call them libraries
#Reduce redundancyin the code
#Uniformity in coding style
#to find the list of modules use help('modules')
In [1]:
help('modules')
In [1]:
import math;
In [4]:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 from math import sum
In [2]:
import math;
print(math.factorial(10))
3628800
In [6]:
dir()
Out[6]:
['In',
'Out',
'_',
'_5',
'__',
'___',
'__builtin__',
'__builtins__',
'__doc__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'_dh',
'_i',
'_i1',
'_i2',
'_i3',
'_i4',
'_i5',
'_i6',
'_ih',
'_ii',
'_iii',
'_oh',
'exit',
'get_ipython',
'math',
'quit']
In [12]:
3628800
In [ ]:
help()
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.9/tutorial/. (ht
tps://docs.python.org/3.9/tutorial/.)
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
help> math
Help on built-in module math:
NAME
In [7]:
Out[7]:
-0.5328330203333975
In [12]:
import datetime
x=datetime.datetime.now()
print (x)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [12], in <cell line: 2>()
1 import datetime
----> 2 x=datetime.now()
3 print (x)
In [25]:
import random
r1=random.randint(0,19)
print(r1)
13
In [10]:
Out[10]:
-0.9880316240928618
In [19]:
import random
r=random.randint(12,22)
print(r)
14
In [4]:
-6.405331196646276
In [ ]:
In [ ]:
In [ ]:
In [ ]: