Page 215 - Robotics and AI class 10
P. 215
>>> print(math.sqrt(16))
4.0
>>> print(math.pow(25,2))
625.0
>>> print(math.fabs(-10))
10.0
>>> print(math.cos(0))
1.0
>>> print(math.sin(90))
0.8939966636005579
Example 2
Few examples of using Python library - random for random number generation:
>>> import random
>>> rollno=[1, 2, 3, 4, 5]
>>> random.shuffle(rollno)
>>>print(rollno)
[1, 3, 2, 4, 5]
>>> random.shuffle(rollno)
>>> print(rollno)
[5, 1, 4, 3, 2]
>>> random_number = random.randint(1, 10) # Generate a random integer between 1 and
10 (inclusive)
>>> print (random_number)
6
>>> random_float = random.random() # Generate a random floating-point number between
0 and 1
>>> print(round(random_float,2))
0.81
Reboot
1. What are python libraries?
2. Who created Matplotlib?
3. What are the points on the graph that represent a data value on a line or scatter chart called?
Introduction to Data and Programming with Python 213

