|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Post #3
If I run it like this... I still get an error.. How do I define time??
This is the error I get... Traceback (most recent call last): File "C:\Documents and Settings\Alex\Desktop\Module1CASE.py", line 19, in ? t = time.localtime(time.time()) NameError: name 'time' is not defined here it is .... print "Petty Cash Account Balance" class Account: def __init__(self, initial): self.balance = initial def deposit (self, amt): self.balance = self.balance + amt def withdraw(self,amt): self.balance = self.balance - amt def getbalance(self): return self.balance a = Account(500000.00) a.deposit(550.23) a.deposit(5000.50) a.deposit(100) a.withdraw(50) print a.getbalance() t = time.localtime(time.time()) st = time.strftime(" %d-%b-%Y %H:%M:%S", t) print t.time() |
|
#2
|
|||
|
|||
|
hi
don't forget to use the code tags next time ![]() you must import the time module like this: Code:
import time |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Post #3 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|