Sleep() returns syntax error in Calculator Project


#1

My question is why is sleep() returning a syntax error sleep is being imported from time. So I should be able to just do sleep(s) where s = numeric value in seconds. I tried writing the the object out completely time.sleep() still returns the same syntax error. I'm pretty sure that this is correct. It even provides you then exact information to input within the project. Can someone assist me? Is it a bug within this project?

""" This is a calculator app. We will let user pick a shape and then calculate the are of the shape chosen """
from math import pi
from time import sleep
from datetime import datetime

now = datetime.now()

print('calculator simulator now simulating')

print("current time: %s/%s/%s/%s:%s" %(now.month.now.day,now.year,now.hour,now.minute)
sleep(1)

hint = "Do not forget to include the correct units! \nExiting...."

option = raw_input("Enter C for Circle or T for Triangle:")

option = option.upper()

if option == 'C':
radius = float(raw_input('Enter 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 value of base:"))
  height = float(raw_input("Enter height of triangle:"))
  area = .5*b*h
  print("Uni Bi Tri...")
  sleep(1)
  print("Area: %.2f \n%s" %(area,hint))

#2

Not able to reproduce this issue. My code works exactly as advertised. Did you ask an Advisor for help? They can look at your work and advise.


#3

I reached out to an advisor. The advisor I talked to was trying to track down an advisor that could help me and he couldn't find anybody to assist me, and then was referred to this forum page.


#4

This work for me

"""
Hello and wellcome to my program. Just follow the rules
"""

from math import pi
from time import sleep
from datetime import datetime

now = datetime.now()

print "The calculator is starting"

print "Current time: %s/%s/%s %s:%s" % (now.month, now.day, now.year, now.hour, now.minute)

sleep(1)

hint = "Do not forget to include the correct units\n"

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 Bi Tri..."
           sleep (1)
           print ("Area: %.2f. \n%s" % (area, hint))
else:
           print "Error!"

#5