Guest User

Untitled

a guest
Jan 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. known=raw_input("What is known? slant side or height: ")
  2. known=known.lower()
  3. if known=="slant side":
  4. from math import sqrt
  5. r=raw_input("Input radius of the base circle: ")
  6. l=raw_input("Input length of slant side: ")
  7. if not r.isalpha() and not l.isalpha():
  8. r=float(r)
  9. l=float(l)
  10. height=l**2-r**2
  11. h=sqrt(height)
  12. h=float(h)
  13. cylinder=pi*h*r**2
  14. volume=cylinder/3
  15. print "Volume of the given cone is %s unit^3" %(volume)
  16. else:
  17. print "Please enter valid values..."
  18. elif known=="height":
  19. h=raw_input("Input height: ")
  20. r=raw_input("Input radius of base circle: ")
  21. if not h.isalpha() and not r.isalpha():
  22. h=float(h)
  23. r=float(r)
  24. cylinder=pi*h*r**2
  25. volume=cylinder/3
  26. print "Volume of the given cylinder is %s unit^3" %(volume)
  27. else:
  28. print "Please enter valid values..."
  29. else:
  30. print "Invalid data..."
Add Comment
Please, Sign In to add comment