[Tutor] I am puzzled - help needed
John Carmona
jeannot18 at hotmail.com
Thu Mar 31 20:58:53 CEST 2005
Alan and John thanks for the help. I have now this bit of script but it is
not running.
----------------------------------------------------------------------------------------------------------
from time import *
n = time()
s = str(n)
numb = s[-2:] # last two characters of the string
numb = int(numb) # convert back to a number
guess = (raw_input('Enter a number: '))
if guess == numb:
print ("Bravo, you have just won the right to play again!")
elif guess < numb:
print "You are just a bit too low, try again"
else:
print "You are just a bit too high, try again"
print "The End"
----------------------------------------------------------------------------------------------------------
If i write the following line:
"n = time.time()
I get the following error message:
---------------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "C:/Python24/Example/high_lowtest.py", line 3, in -toplevel-
n = time.time()
AttributeError: 'builtin_function_or_method' object has no attribute 'time'
--------------------------------------------------------------------------------------------------------
I feel like an idiot asking what is probably very basics questions but my
desire to learn is quite high right now and I don't want to lose it, thanks
again
More information about the Tutor
mailing list