Area calculator

can you please let me know what the error:

$ python
File “”, line 17
area = 0.5 *base *height
IndentationError: unindent does not match any o
uter indentation level

Area calculator

print “Program is starting”

option = raw_input(“ENter t or c:”)

if option == “C”:
radius = float(raw_input(“enter radius”))
area = 3.14 * radius**2
print “Area %f” %(area)

elif option == “T”:
base = float(raw_input(“enter base”))
height = float(raw_input(“enter height”))
area = 0.5 * base * height
print “Area %f” %(area)

print “Invalid” %option

print (“the end”)

Please post a link to the assignment this code is meant to complete, and then post the code in Python, a language in which indentations are manditiory, not optional.

To do that, just use the </> icon that appears in the middle of the menu bar that is at the top of your text box when you are typing in it.

If you do so, your code will be easy to read, any readers will be able to copy and paste it for testing!


1 Like