Two things I'm looking for help with:
- I'm looking for a better way to take in a line of text (in my code's case, some song information). I want the user to be able to type in one line of information; currently, the user has to type in two lines of information (i.e. track number then song title). For example, the user should be able to type in "1 Dream On" or "1. Dream On"
- A better way to break the loop without using a keyword or phrase. Since the title of a song could be practically any name, I can't use that input as a way to break the loop. For instance, with the loop break depending on the user inputting "done", this disallows song title's from being set to "done".
Basically you have to decide how your program should handle erroneous input, and decide what this input is likely to be. I am an ex High School Digital Technologies teacher and as part of the planning process, before coding commenced, I used to get my students to create a testing plan that had examples of input (good and bad) and what to expect to happen with such input (good and bad consequences). They could then test their programs, once they had written the first iteration of them, using the testing plan values and see whether expected output matches actual ouput. It can be a pretty tedious task writing such a plan but it really helps to nail down program design.
If it was my program I would have as acceptable input for track numbers, integer values in the range 1 to 20 (I am thinking that this would be the highest track number - this can be changed). Any other input would cause the user to be told about their error (precisely) and asked to enter the track number again, OR you could just exit the program after displaying the error message and get them to start again.
You also need to allow for song names to be more than one word. I don't think your program handles this at the moment.
I would put the code that asks for a track number and then tests its validity in its own function. It could then return the track number on success or false on failure. In fact each logical part of your program should probably be in its own function.