The message I’m getting:
No matter what, it always responds as though I entered C.
""" This program should be able to: 1. Prompt the user for a shape (a circle or a triangle) 2. Compute the area of that shape 3. Print the area of that shape for the user. """ def AreaCalculator(): print("Firing up the clackalater...") option = raw_input("Enter C for Circle or T for Triangle: ") if option == 'C' or 'c': radius = float(raw_input("The radius of my circle is: ")) area = 3.14159 * radius ** 2 print("The area of your cicle is " + str(area) + ".") elif option == 'T' or 't': base = float(raw_input("The base of my triangle is: ")) height = float(raw_input("The height of my triangle is: ")) area = (base * height) / 2 print("The area of your triangle is " + str(area) + ".") else: print("Invalid response.") print("""Pressing CE... pressing Power...""") AreaCalculator()
I know it didn’t say to format it as a function, but I thought maybe that would help me have more control over the flow of the program. It does the exact same thing whether I put the code inside a function or not.
I tried to debug it at repl.it, but programs with
raw_input() never work outside of Codecademy and I don’t know why.
else block doesn’t appear to be working either: