Created
August 20, 2017 18:33
-
-
Save khayyamsaleem/c0a0e45fa369eaff2faaad5cb0b4ee6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This program will allow a user to calculate the area of any shape chosen | |
""" | |
from math import pi | |
from time import sleep | |
from datetime import datetime | |
now = datetime.now() | |
print "Starting the calculator..." | |
print "Current time:%s/%s/%s%s:%s" % (now.month, now.day, now.year, now.hour, now.minute) | |
sleep(1) | |
hint = "Don't forget to include the correct units! \nExiting..." | |
option = raw_input("Enter C for Circle or T for Triangle: ") | |
option = option.upper() | |
if option == 'C' : | |
radius = float(raw_input("Enter radius: ")) | |
area = pi * (radius**2) | |
print "The pie is baking..." | |
sleep(1) | |
print ("Area: %.2f. \n%s" % (area, hint)) | |
elif option =='T': | |
base = float(raw_input("Enter base: ")) | |
height = float(raw_input("Enter height:")) | |
area = 0.5 * base * height | |
print "Uni Bi Tri..." | |
sleep(1) | |
print ("Area: %.2f. \n%s" % (area, hint)) | |
else: | |
print "Error! Invalid shape selector specified. Exiting." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment