# Syntax errors, having a hard time seeing where Im going wrong!

#1

I'm consistently getting

File "AreaCalculator.py", line 11
option = option.upper()
^
SyntaxError: invalid syntax

and if I remove the line 11

I get the error...

File "AreaCalculator.py", line 11
if option == 'C':
^
SyntaxError: invalid syntax

I've become bind to any of the errors I have made, A second pair of eyes and some pointers would be much appreciated.

best,

C

``````"""Area calculator, program prompts the user to selects a shape, the program then calculates and reports the area of the shape to the user in the consaole."""
from math import pi
from time import sleep
from datetime import datetime
now = datetime.now()
hint = "Dont forget to include the correct units! \nExiting..."
print "Welcome to the Area Calculator"
print '%s/%s/%s %s:%s' % (now.month, now.day, now.month, now.hour, now.minute)
sleep(1)
print 'Enter C for Circle and T for Triangle'
option = (raw_input('Enter C for Circle and T for triangle')
option = option.upper()
if option == 'C':
print "Input the radius of the Circle"
print "The pie is baking"
sleep(1)
print ("Area: %.2f. \n%s" % (area,hint))
elif option == 'T':
print "Input the length of the base of your triangle"
base = float(raw_input("Enter base length: "))
print "Input the heigth of the tringle"
heigth = float(raw_input("Enter heigth: "))
area = (0.5)*(base*height)
print "Uni Bi Tri..."
sleep(1)
print ("Area: %.2f. \n%s" % (area,hint))
else:
sleep(1)
print "I think you've entered garbage there, the program will have to exit unfortunatly"``````

#2

this line:

``option = (raw_input('Enter C for Circle and T for triangle')``

pay close attention to the parentheses

#3

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