Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions solutions/python/bob/1/bob.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def response(hey_bob):
msg = hey_bob.strip()

if not msg:
return "Fine. Be that way!"

is_question = msg.endswith("?")
is_yelling = msg.upper() == msg and msg.lower() != msg

if is_yelling and is_question:
return "Calm down, I know what I'm doing!"
elif is_yelling:
return "Whoa, chill out!"
elif is_question:
return "Sure."
else:
return "Whatever."