Lab Unit-1 Programs
Lab Unit-1 Programs
PYTHON PROGRAMMING
Lab: Unit-1
1. Write a python program to compute distance between two points (x1,y1) and (x2,y2)
#Program:
import math
x1 = int(input("Enter the values x1:"))
x2 = int(input("Enter the values x2:"))
y1 = int(input("Enter the values y1:"))
y2 = int(input("Enter the values y2:"))
print("The value of distance b/w two points as
follows:")
print("x1 coordinate:",x1)
print("x2 coordinate:",x2)
print("y1 coordinate:",y1)
print("y2 coordinate:",y2)
Distance=math.sqrt(pow((x2-x1),2)+pow((y2-y1),2))
print("Distance of two points:”, Distance)
Output:
2. Write a python program to print the decimal equivalents of 1/2, 1/3 ... 1/10
#Program:
i=1
while(i<=10):
print("1/”, i,"=",1/i)
i=i+1
Output:
PYTHON PROGRAMMING