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
24 changes: 24 additions & 0 deletions solutions/python/bob/1/bob.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def response(hey_bob):
# Fix the Indentation for all lines below!
trimmed_input = hey_bob.strip()

# Yelling a Question (Most Specific)
if trimmed_input.endswith('?') and trimmed_input.isupper():
return "Calm down, I know what I'm doing!"

# Yelling (Next Specific)
# Be careful not to count empty strings or questions as yelling!
elif trimmed_input.isupper():
return "Whoa, chill out!"

# Question (Next Specific)
elif trimmed_input.endswith('?'):
return "Sure."

# Silence
elif trimmed_input == '':
return "Fine. Be that way!"

# Anything Else
else:
return "Whatever."