Created
October 20, 2017 05:38
-
-
Save sunnyeyez123/2422167df75e5409c8611fe95f424559 to your computer and use it in GitHub Desktop.
I am just getting into Python to ease myself back into writing code more regularly. I made this program in a Codecademy freeform project. I want to expand it to different shapes.
This file contains 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 is a program that calculates the area of triangles and circles''' | |
from math import pi | |
from time import sleep | |
from datetime import datetime | |
now = datetime.now() | |
print "The calculator is starting" | |
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() | |
print option | |
if option == 'C': | |
radius = float(raw_input("What is the 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("What is the base: ")) | |
height = float(raw_input("What is the height: ")) | |
area = .5 * base * height | |
print "Uni Bi Tri..." | |
sleep(1) | |
print("Area: %.2f \n%s" % (area, hint)) | |
else: | |
print "You entered garbage! Goodbye." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment