When, exactly? And what result are you expecting?
The way your script is written:
choosing dorian returns {“1, 2, 3, 4, 7”} as list – a list containing a single string separated by comma and space.
choosing mixolydian returns “2, 3, 4, 6, 7” – a single string separated by comma and space.
choosing lydian returns {“3 4 5 6 7”} - a list containing a single string separated by space but no comma.
choosing blues returns “4, 5, 6, 7, 8” – a single string separated by comma and space.
choosing phrygian returns " 4, 5, 6, 7, 8" – a single string separated by comma and space but beginning with a space.
So, depending on your user’s choice, you have four differently formatted outputs: only mixolydian and blues are consistent.
Try to understand the differences between these inconsistent results. From that, you may begin to understand why it is important for you to be consistent when you write your scripts and set your variables. Look at each result and decide how the rest of your script will handle the output from your choose from list command.
Then check again: is “blues” the same as “phrygian”? Your script suggests that it is, although the returned value from “phrygian” has an extra space at the beginning. I don’t know - as I’ve said before, I only have a very limited understanding of musical theory.
Discipline yourself: check for your own inconsistencies and think sequentially. Read what you type. Stand back from it. Think about what might be wrong.
Start with small chunks. Make sure they work as chunks before you start stringing them together. Understand what you are doing and why you are doing it.
Don’t just copy stuff and assume that it will work. Read it, understand it, think about why it might not work.
Don’t do complicated stuff before you really understand how to do simple stuff.
Never give up…