On 20/07/17 18:41, Daniel Bosah wrote:
> I'm trying to get my function to work:

Did you read any of the replies to your previous message?

You do not appear to have applied any of the suggestions.

>  def deposit(self,amount):
>         if amount > 0:
>             self.balance += amount
>             self.show_balance()
>             
> self.transaction_list.append((pytz.utc.localize(datetime.datetime.utcnow()),amount))
> # appends traction details to list
> 
>     def show_transactions(self):
>         for date, amount in self.transaction_list:
>             if amount > 0:
>                 tran_type = "deposited"
>             else:
>                 tran_type = "withdrawn"
>                 amount *= -1 # to show negative number
>                 print "{:6} {} on {} (local time was {})".format(amount,
> tran_type, date, date.astimezone())


But you are showing us less code...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to