Help with Project


Hello, can someone check my code for this project?

It kept on saying this:

SyntaxError: invalid syntax
$ python
File "", line 34
SyntaxError: invalid syntax

"""This is a calculator that can compute the area of a given shape, as selected by the user. The calculator will be able to determine the area of the following shapes: circle and triangle"""

from math import pi 
from time import sleep
from datetime import datetime 

now =

print 'Let\'s start!'

print "%s/%s/%s %s:%s" %(now.month,, now.year, now.hour, now.minute)


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 the radius: "))
  area = pi * radius**2
  print "The pie is baking..."
  print ("Area: %.2f. \n%s" % (area, hint))   

elif option == 'T':
	base = float(raw_input("Enter the base of the triangle: "))
height = float(raw_input("Enter the height of the triangle: "))
area = 0.5 * height * base
print "Uni Bi Tri..."          

print ("area: %.2f. \n%s" % (area, hint))

  print "Error! Exiting."

Thank you!!!


The indentation in your elif branch is inconsistent, with many lines being outside of the block.


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