Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. class HelloWorld:
  2.  
  3.     def __init__(self, firstName, lastName):
  4.         self.firstName = firstName
  5.         self.lastName = lastName
  6.  
  7.     def display(self):
  8.         return self.firstName + ' ' + self.lastName
  9.  
  10.     # Send a little message
  11.     def message(self):
  12.         print("nice to meet you " + self.firstName + ' ' + self.lastName)
  13.         print('Hope you are well today?')
  14.  
  15.         mood = input('Are you well today ' + self.firstName + '? (yes or no): ')
  16.         print(repr(mood))
  17.         if mood == 'y' or 'yes':
  18.             print("That\'s great news " + self.firstName + "!")
  19.         elif mood == "n" or "no":
  20.             print('Oh dear.. ' + self.firstName + ' thats not good at all.')
  21.         else:
  22.             print('Error!, Sorry I don\'t understand that responce')
  23.  
  24. name = HelloWorld(input('Please enter a first Name: '), input('Now enter a last name: '))
  25. name.message()
  26.  
  27. OUTPUT:
  28. Please enter a first Name: test1
  29. Now enter a last name: test2
  30. nice to meet you test1 test2
  31. Hope you are well today?
  32. Are you well today test1? (yes or no): im ok
  33. 'im ok'
  34. That's great news test1!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement