Dark theme

Answers


How did you do? If we decompose the problem fully, we get code like this (test6.py):

words = """Every Night & every Morn
Some to Misery are Born
Every Morn and every Night
Some are Born to sweet delight"""

# Find the first word "Morn"
character = chr(122)
print(character)

character_location = lyrics.find(character)
print(character_location)

end_location = lyrics.find(" ", character_location)
print(end_location)

first_m_word = lyrics[character_location : end_location]
print(first_m_word)

Running this, we get:
z
-1
-1
 

The problem is we're looking for a "z", not a capital "M" (and note capitals have different codes from lowercase). Can you use ord() to work out what the value should be, and fix it?