Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. import math
  2. import time
  3. name = raw_input("What is your name? ")
  4. print "Hello " + name + "!"
  5. # Calc circumference circle
  6. print "Calculate the circumference of a circle given the radius"
  7. z = 1
  8. y = 0
  9. while True:
  10.     try:
  11.         radius = int(raw_input("The radius of circle:"))
  12.         print "The Circumference is:"
  13.         print 2 * math.pi * radius
  14.         break
  15.     except:
  16.         while z == 1:
  17.             print "Insert a number"
  18.             radius = input("The radius of circle:")
  19.             if isinstance(radius, int) == True:
  20.                 print "The Circumference is:"
  21.                 print 2 * math.pi * radius
  22.                 break
  23.                 z + 1
  24.             elif isinstance(radius, int) == False:
  25.                 print "Insert a number"
  26.                 radius = input("The radius of circle:")
  27.                 z = 1
  28. #Calculate Area of circle
  29. print "Calculate the area of a circle"
  30.  
  31. while True:
  32.     try:
  33.         radiussqrd = int(raw_input("The radius of circle:"))
  34.         print "The area is: "
  35.         print math.pi * math.pow(radiussqrd, 2)
  36.         break
  37.     except:
  38.         print "Insert an integer"
  39.         print "The area is: "
  40.         print math.pi * math.pow(radiussqrd, 2)
  41.         break
  42. #Calculate oppervlakte cirkel
  43. print "Calculate area of square"
  44. a = input("Side of square:")
  45. loopindex = 4
  46. for loopindex in range(1, 4):
  47.         time.sleep(1)
  48.         print str(loopindex)+ "..."
  49. print "The area of the Square is equal to:"    
  50. print math.pow(a, 2)
  51. #Calculate Area Rectangle
  52. print "Calculate the area of a rectangle"
  53. length = input("Length of the rectangle:")
  54. width = input("Width of the rectangle:")
  55. loop = 4
  56. for loop in range(1,4):
  57.     time.sleep(1)
  58.     print str(loop) + "..."
  59. print "The area of the rectangle is equal to:"
  60. print length * width
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement