Created
October 18, 2017 22:14
-
-
Save khayyamsaleem/0aeb84d67d051d0fa3d9439180e356ce 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 prompts the user to select a shape | |
#depending on the shape the user selects, the | |
#program will return the calculated area of that | |
#shape | |
#import pi Python code | |
from math import pi | |
#code to simulate a thinking calculator | |
from time import sleep | |
#import time | |
from datetime import datetime | |
now=datetime.now() | |
print "Area Calc: ON" | |
print"Current time %s/%s/%s %s:%s"%(now.month,now.day,now.year,now.hour,now.minute) | |
"""delay processing the next line of code by an amount of time that you specify""" | |
sleep(1) | |
hint="Don't forget to include the correct units! \nExiting..." | |
option=raw_input("Enter C for Cicle or T for Triangle: ") | |
correct=option.upper() | |
if correct=='C': | |
radius=float(raw_input("enter radius of circle: ")) | |
area=pi*radius*2 | |
print "The pie is cooking" | |
sleep(1) | |
print ("Area: %.2f \n%s"%(area,hint)) | |
elif correct =='T': | |
H=float(raw_input("enter height of triangle: ")) | |
L=float(raw_input("enter length of base: ")) | |
area2=(H*L)/2 | |
print "Uni Bi Tri" | |
sleep(1) | |
print ("Area %.2f \n%s" % (area2,hint)) | |
else: | |
print "ERROR: INVALID ENTRY:Please enter C or T" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment