I've completed the Area Calculator exercise, saved the code in .py format and tried to run it in Terminal. It seems that Terminal has problems importing items from database. Is the database used in the course something I should download separately? Could someone help? (please see the code and errors below)
Secondly, I'm a Mac user and since it has Python built in it I was under the impression I can just run the material from this course in Terminal. Yet, Terminal accepts 2 spaces for indentation instead of four. Is the content of this Course designed primarily for Windows users? If not, could you point me to a source of information specifying the differences I should keep in mind when moving between the course and Terminal?
Please see the code and errors below:
from math import pi from time import sleep from datetime import datetime now = datetime.now() print "The area calculator is starting up..." print "%s/%s/%s %s:%s" % (now.month, now.day, now.year, now.hour, now.minute) sleep(1) hint = "Don't forget to include the corect units... " 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..." sleep(1) print ("Area: %.2f. \n%s" % (area, hint)) elif option == 'T': base = float(raw_input("Enter the base: ")) height = float(raw_input("Enter the height: ")) area = (0.5)*base*height print "Uni Bri Tri..." sleep(1) print ("Area: %.2f. \n%s" % (area, hint)) else: print "Error! Invalid shape selector specified. Exiting."