-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop_python.py
More file actions
36 lines (28 loc) · 1023 Bytes
/
Copy pathoop_python.py
File metadata and controls
36 lines (28 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# GIT VERSION LEARNING
# FOSE Muhammad Umer Haroon
class Smile_Bot:
def __init__(self, name):
self.name = name
def greet(self):
return f"Hi there! I'm {self.name}. What's your name?"
def compliment(self):
return "You have a smile that can make me lol!"
def respond(self, message):
if "hello" in message.lower():
return self.greet()
elif "thank you" in message.lower():
return "You're welcome! But honestly, it's hard not to compliment you."
else:
return "Tell me more about yourself!"
if __name__ == "__main__":
smiley = Smile_Bot("talk")
print(smiley.greet())
user_name = input("Your name: ")
print(f"Nice to meet you, {user_name}!")
while True:
user_message = input("You: ")
if user_message.lower() in ["exit", "quit"]:
print("smiley: Catch you later :)!")
break
response = smiley.respond(user_message)
print(f"smiley: {response}")