Basic Python Programs
Basic Python Programs
5. WAP to input a No. & print its double, cube, square and half.
A=int(input('Enter a No. '))
C=A*2
D=A*A*A
E=A*A
F=A/2
print('Double is ',C)
print('Cube is ',D)
print('Square is ',E)
print('Half is ',F)
6. WAP to input the sides of a Rectangle & print its Area and perimeter.
L=int(input('Enter Length of a Rectangle '))
B=int(input('Enter Breadth of a Rectangle '))
A=L*B
P=2*(L+B)
print('Area is ',A)
print('Perimeter is ',P)
7. WAP to input the side of a Square & print its Area and perimeter.
S=int(input('Enter Length of a Rectangle '))
A=S*S
P=4*S
print('Area is ',A)
print('Perimeter is ',P)