Can it be cleaner? or improved?
sweetphilly2 (0)

Repl: https://repl.it/join/ivqffjsn-sweetphilly2

Hello,

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".
You are viewing a single comment. View All
Answered by malvoliothegood (718) [earned 5 cycles]
View Answer
sweetphilly2 (0)

@malvoliothegood Thank you for the reply.
What if the user inputs "1."? How should that be handled?
I'm assuming I could write an if-statement to check for it before assigning the track number. Not sure if that's the best way to go about it though.