Programming Examples

Python program to input any choice and to implement the following


Write a program to input any choice and to implement the following.

Choice Find

1. Area of square

2. Area of rectangle

3. Area of triangle

Solution

c = input ("Enter any Choice")
if(c==1):
	s = input("enter any side of the square")
	a = s*s
	print"Area = ",a
elif(c==2):
	l = input("enter length")
	b = input("enter breadth")
	a = l*b
	print"Area = ",a
elif(c==3):
	x = input("enter first side of triangle")
	y = input("enter second side of triangle")
	z = input("enter third side of triangle")
	s = (x+y+z)/2
	A = ((s-x)*(s-y)*(s-z))**0.5
	print"Area=",A
else:
	print "Wrong input"
Output

Enter any Choice2
enter length4
enter breadth6
Area = 24
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad