he-017
1.000
Proposed solution
```python
from typing import List
def parse_music(music_string: str) -> List[int]:
""" Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
>>> parse_music('o o| .| o| o| .| .| .| .| o o')
[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
"""
# Create a mapping of note symbols to their beat values
note_beats = {
'o': 4, # whole note
'o|': 2, # half note
'.|': 1 # quarter note
}
# Split the input string by spaces to get individual notes
notes = music_string.split()
# Convert each note to its corresponding beat value
result = []
for note in notes:
result.append(note_beats[note])
return result
```Test output (stdout)
. [100%] 1 passed in 0.01s
System prompt
You are an expert programmer. Solve the task exactly as specified. Output your solution as fenced code blocks using the required file name(s) and the exact function/type signatures requested. Prefer correctness; do not include prose outside code unless asked.