def response(hey_bob):
#question
if hey_bob.endswith("?") == 1 and hey_bob.isupper() == False:
return 'Sure.'
#yelling
if hey_bob.isupper() == True and hey_bob.endswith("?") == 0:
return "Whoa, chill out!"
#yelling question
if hey_bob.isupper() == True and hey_bob.endswith("?"):
return "Calm down, I know what I'm doing!"
#silence
if hey_bob.isspace() or hey_bob == "":
return "Fine. Be that way!"
#anything else
else:
return "Whatever."
Hi! I'm really green when it comes to coding and I'm struggling to find a way to overcome this exercise. I can't deal with this one test:
** Test 23 Bob > ending with whitespace**
Code Run
self.assertEqual(
response("Okay if like my spacebar quite a bit? "), "Sure."
Test Failure
AssertionError: 'Whatever.' != 'Sure.'
- Whatever.
- Sure.
Help highly appreciated! :D