I have started coding for about a week, and while practicing to create a shape calculator, I encountered such an error:
Traceback (most recent call last):
File "python", line 4
if option = 'C':
^
SyntaxError: invalid syntax
The code is as follows:
print "The Calculator has been launched"
option = raw_input ("What shape is your object? Enter C for circle or T
for Triangle.")
if option = 'C':
radius = float (raw_input ("What is the radius of your circle?") )
area_1 = 3.14159 * ( radius ** 2)
print area_1
elif option = 'T':
base = float (raw_input ("What is the base of the triangle?"))
height = float (raw_input ("What is the corresponding height of the
triangle?"))
area_2 = (base * height) * 1/2
print area
else :
print "Please, enter a valid shape"
I would be very grateful if someone could explain the cause of the error.
Thanks!