A streaming music platform needs to compile and index its standard list of music genres.
The file Genres.txt contains a list of ten master genres.
Write a program to implement these requirements.
For all lines in the Genres.txt file, the code must:
You should structure your program cleanly by opening and closing files correctly.
| Genres.txt | Indexed.txt |
|---|---|
| Rock | 1 Rock |
| Pop | 2 Pop |
| Jazz | 3 Jazz |
| Classical | 4 Classical |
| Hip Hop | 5 Hip Hop |
| Electronic | 6 Electronic |
| Reggae | 7 Reggae |
| Blues | 8 Blues |
| Folk | 9 Folk |
| Country | 10 Country |