Kernel: Python 3 (system-wide)
Practice & Refresh
- Write a Python program to compute the distance between the points (x1, y1) and (x2, y2).
In [1]:
6.324555320336759
- Write a Python program to calculate the hypotenuse of a right angled triangle.
In [0]:
- Write a Python program to plot on the same figure y1=sin(x) and y2=0.5, and configure the range of y-axis to (-2,2)
In [25]:
[<matplotlib.lines.Line2D at 0x7f97293c2eb0>]
- Write a Python program to create an array of 10 zeros,10 ones, 10 fives.
In [30]:
[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
[5. 5. 5. 5. 5. 5. 5. 5. 5. 5.]
- Write a Python program to create a 3x3 identity matrix, i.e. diagonal elements are 1, the rest are 0.
In [31]:
[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
- Write a Python program to plot Gaussian distribution with mean=0 and standard deviation = 1.
In [36]:
In [0]: