Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- known=raw_input("What is known? slant side or height: ")
- known=known.lower()
- if known=="slant side":
- from math import sqrt
- r=raw_input("Input radius of the base circle: ")
- l=raw_input("Input length of slant side: ")
- if not r.isalpha() and not l.isalpha():
- r=float(r)
- l=float(l)
- height=l**2-r**2
- h=sqrt(height)
- h=float(h)
- cylinder=pi*h*r**2
- volume=cylinder/3
- print "Volume of the given cone is %s unit^3" %(volume)
- else:
- print "Please enter valid values..."
- elif known=="height":
- h=raw_input("Input height: ")
- r=raw_input("Input radius of base circle: ")
- if not h.isalpha() and not r.isalpha():
- h=float(h)
- r=float(r)
- cylinder=pi*h*r**2
- volume=cylinder/3
- print "Volume of the given cylinder is %s unit^3" %(volume)
- else:
- print "Please enter valid values..."
- else:
- print "Invalid data..."
Add Comment
Please, Sign In to add comment