Can anyone help me find this syntax error?


This one is bugging me, getting this error message from my code.

SyntaxError: invalid syntax                                                            
$ python                                                             
  File "", line 23                                                    
    elif option == 'T':                                                                
SyntaxError: invalid syntax

Any ideas?

This code will work out the area of a shape decided
by the user and print that area

from math import pi
from time import sleep
from datetime import datetime
now =

print "Caculator is starting up"
print "Current time: %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 T for triangle or C for circle")
option = option.upper()
if option == 'C':
    radius = float(raw_input("enter the radius of the sphere"))
    area = pi*(radius ** 2)
    print "pie is baking..."
    print ("Area: %.2f. \n%s" % (area, hint)
elif option == 'T':
    base = float( raw_input(" enter base or triangle"))
    area = 0.5* base**2
    print "uni bi tri"
    print ("Area: %2f. \n%s" % (area, hint))
    print"error! invalid shape specified. exiting"


What you're allowed to write at a certain place depends on what has been written so far.


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