Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import time
- name = raw_input("What is your name? ")
- print "Hello " + name + "!"
- # Calc circumference circle
- print "Calculate the circumference of a circle given the radius"
- z = 1
- y = 0
- while True:
- try:
- radius = int(raw_input("The radius of circle:"))
- print "The Circumference is:"
- print 2 * math.pi * radius
- break
- except:
- while z == 1:
- print "Insert a number"
- radius = input("The radius of circle:")
- if isinstance(radius, int) == True:
- print "The Circumference is:"
- print 2 * math.pi * radius
- break
- z + 1
- elif isinstance(radius, int) == False:
- print "Insert a number"
- radius = input("The radius of circle:")
- z = 1
- #Calculate Area of circle
- print "Calculate the area of a circle"
- while True:
- try:
- radiussqrd = int(raw_input("The radius of circle:"))
- print "The area is: "
- print math.pi * math.pow(radiussqrd, 2)
- break
- except:
- print "Insert an integer"
- print "The area is: "
- print math.pi * math.pow(radiussqrd, 2)
- break
- #Calculate oppervlakte cirkel
- print "Calculate area of square"
- a = input("Side of square:")
- loopindex = 4
- for loopindex in range(1, 4):
- time.sleep(1)
- print str(loopindex)+ "..."
- print "The area of the Square is equal to:"
- print math.pow(a, 2)
- #Calculate Area Rectangle
- print "Calculate the area of a rectangle"
- length = input("Length of the rectangle:")
- width = input("Width of the rectangle:")
- loop = 4
- for loop in range(1,4):
- time.sleep(1)
- print str(loop) + "..."
- print "The area of the rectangle is equal to:"
- print length * width
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement