Advertisement
mariodian

Happy Birthday in Python

Aug 8th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. #!/usr/local/bin/python2.7
  2. from datetime import date
  3. from dateutil import parser
  4.  
  5. class Boyfriend:
  6.     def __init__(self, name, birthdate):
  7.         self.name = name
  8.         self.birthdate = parser.parse(birthdate);
  9.    
  10.     def happyBirthday(self):
  11.         return "Happy " + str(date.today().year - self.birthdate.year) + "th Birthday my " + self.name + "!"
  12.  
  13. myBoyfriend = Boyfriend("Fero", 'Aug 25 1990')
  14. print myBoyfriend.happyBirthday()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement