'''
import math
print(math.sqrt(36))
import math as m
print(m.sqrt(36))
from math import *
print(sqrt(36))
print(pow(6,2))
from math import sqrt,log10,pi
print(sqrt(36))
print(log10(10))
print(pi)
import random
print(random.randrange(5))
print(random.randrange(10,16))
'''
def sum():
print(5+6)
sum()
def sum(a,b):
print(a+b)
sum(5,8)
k=sum(2,3)
print(k)
print(sum(9,6))
def prod(a,b):
return a*b
print(prod(5,6))
k=prod(5,8)
print(k)
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> math.sqrt(25)
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
math.sqrt(25)
NameError: name 'math' is not defined
>>> sqrt(25)
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
sqrt(25)
NameError: name 'sqrt' is not defined
>>> import math
>>> math.sqrt(25)
5.0
>>> math.pow(2,3)
8.0
>>> math.pow(3,0)
1.0
>>> math.pow(100,-2)
0.0001
>>> abs(-5)
5
>>> math.fabs(-5)
5.0
>>> math.fabs(5)
5.0
>>> math.ceil(3.2)
4
>>> math.ceil(3.9)
4
>>> math.floor(3.9)
3
>>> math.floor(3.2)
3
>>> math.cos(30)
0.15425144988758405
>>> math.sin(30)
-0.9880316240928618
>>> math.tan(30)
-6.405331196646276
>>> math.log10(100)
2.0
>>> print(help(math.cos))
Help on built-in function cos in module math:
cos(x, /)
Return the cosine of x (measured in radians).
None
>>> print(help(bin))
Help on built-in function bin in module builtins:
bin(number, /)
Return the binary representation of an integer.
>>> bin(2796202)
'0b1010101010101010101010'
None
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
Traceback (most recent call last):
File "C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py", line 2, in <module>
print(sqrt(36))
NameError: name 'sqrt' is not defined
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
Traceback (most recent call last):
File "C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py", line 2, in <module>
print(math.sqrt(36))
NameError: name 'math' is not defined
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
36.0
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
36
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
Traceback (most recent call last):
File "C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py", line 15, in <module>
print(log10(10))
NameError: name 'log10' is not defined
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
Traceback (most recent call last):
File "C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py", line 16, in <module>
print(pi)
NameError: name 'pi' is not defined
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
3.141592653589793
>>> sqrt(16)
4.0
>>> log10(10)
1.0
>>> from math import *
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
Traceback (most recent call last):
File "C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py", line 14, in <module>
import math.sqrt
ModuleNotFoundError: No module named 'math.sqrt'; 'math' is not a package
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
3.141592653589793
Traceback (most recent call last):
File "C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py", line 19, in <module>
print(random.randrange())
TypeError: randrange() missing 1 required positional argument: 'start'
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
3.141592653589793
0
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
3.141592653589793
1
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
6.0
1.0
3.141592653589793
0
>>> random.randrange(5)
2
>>> random.randrange(5)
3
>>> random.randrange(5)
2
>>> random.randrange(5)
0
>>> random.randrange(5)
0
>>> random.randrange(5)
1
>>> random.randrange(5,10)
8
>>> random.randrange(5,10)
6
>>> random.randrange(5,10)
9
>>> random.randrange(5,10)
5
>>> random.random()
0.8535010982692898
>>> random()
Traceback (most recent call last):
File "<pyshell#34>", line 1, in <module>
random()
TypeError: 'module' object is not callable
>>> from random import *
>>> random()
0.5113307022171122
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
2
10
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
0
14
>>> randrange(10,16)
Traceback (most recent call last):
File "<pyshell#37>", line 1, in <module>
randrange(10,16)
NameError: name 'randrange' is not defined
>>> from random import *
>>> randrange(10,16)
14
>>> randrange(10,16)
10
>>> random(10,16)
Traceback (most recent call last):
File "<pyshell#41>", line 1, in <module>
random(10,16)
TypeError: random() takes no arguments (2 given)
>>> randrange(10.0,16.0)
14
>>> randint(5,10)
9
>>> randint(5,10)
7
>>> randint(10)
Traceback (most recent call last):
File "<pyshell#45>", line 1, in <module>
randint(10)
TypeError: randint() missing 1 required positional argument: 'b'
>>> uniform(5,10)
5.833345307979021
>>> choice([5,8,2,9])
2
>>> L=[10,15,5,9]
>>> choice(L)
10
>>> choice(L)
15
>>> L=['Salvi','Poonam','Raj']
>>> choice(L)
'Salvi'
>>> choice(L)
'Poonam'
>>> L=(10,15,5,9)
>>> choice(L)
9
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
5
None
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
5
None
15
None
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
5
None
15
None
30
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
5
None
15
None
30
40
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
5
None
15
None
None
None
>>>
= RESTART: C:/Users/S P SHARMA/AppData/Local/Programs/Python/Python38-32/15feb1.py
11
13
5
None
15
None
30
40
>>>
No comments:
Post a Comment