Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HelloWorld:
- def __init__(self, firstName, lastName):
- self.firstName = firstName
- self.lastName = lastName
- def display(self):
- return self.firstName + ' ' + self.lastName
- # Send a little message
- def message(self):
- print("nice to meet you " + self.firstName + ' ' + self.lastName)
- print('Hope you are well today?')
- mood = input('Are you well today ' + self.firstName + '? (yes or no): ')
- print(repr(mood))
- if mood == 'y' or 'yes':
- print("That\'s great news " + self.firstName + "!")
- elif mood == "n" or "no":
- print('Oh dear.. ' + self.firstName + ' thats not good at all.')
- else:
- print('Error!, Sorry I don\'t understand that responce')
- name = HelloWorld(input('Please enter a first Name: '), input('Now enter a last name: '))
- name.message()
- OUTPUT:
- Please enter a first Name: test1
- Now enter a last name: test2
- nice to meet you test1 test2
- Hope you are well today?
- Are you well today test1? (yes or no): im ok
- 'im ok'
- That's great news test1!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement