Calculator than can compute the area of a given shape


#1

Hi! Can anyone help me with this error?

Thanks!

$ python AreaCalculator.py
File "AreaCalculator.py", line 26
print "The pie is baking..."
^
IndentationError: unindent does not match any oute
r indentation level

"""
calculator than can compute the area of a given shape (circle or triangle)
"""

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 = "Dont forget to include the correct units! \n Existing..."

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: %s.2f. \n%s" % (area,hint))

elif option == "T":
base = float(raw.input("Enter the base: "))
height = float(raw.input("Enter the height"))
area = (0.5)baseheight
print "Uni Bi Tri"
sleep(1)
print("Area: %s.2f. \n%s" % (area,hint))

else:
print "Enter the correct option otherwise the program will exit"


#2

What's the problem? You've got an error message explaining why your code isn't valid, is there something you're wondering about that message? Have you read it? Have you tried googling it? It mentions indentation, have you considered your indentation at that location? What does your code actually look like? If others are to look at your code and the problem has to do with indentation, then it would be useful if the indentation of your code showed in your post (regardless of what the error message is really, because otherwise you're posting something different from what you're running)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.