Sep-18-2020, 07:48 AM
I was trying to get this output...
My Seven Favorite Musical Artists
Enter Musical Artist: Drake
Enter Musical Artist: Cardi B
Enter Musical Artist: Justin Bieber
No Way!
Enter Musical Artist: Ariana Grande
Enter Musical Artist: Travis Scott
Enter Musical Artist:
That's less than seven, but OK
1. Drake
2. Cardi B
4. Ariana Grande
5. Travis Scott
End of Favorites!
I wrote this code and definitely understand why it has errors, I just don't have ideas on how to fix them because I don't really know how and where to place "breaks" and "continues".
My Seven Favorite Musical Artists
Enter Musical Artist: Drake
Enter Musical Artist: Cardi B
Enter Musical Artist: Justin Bieber
No Way!
Enter Musical Artist: Ariana Grande
Enter Musical Artist: Travis Scott
Enter Musical Artist:
That's less than seven, but OK
1. Drake
2. Cardi B
4. Ariana Grande
5. Travis Scott
End of Favorites!
I wrote this code and definitely understand why it has errors, I just don't have ideas on how to fix them because I don't really know how and where to place "breaks" and "continues".
print("My Seven Favorite Musical Artists\n") output = "" for ii in range(1, 8): artist = input("Enter Musical Artist: ") output = output + str(ii) + ". " + artist + "\n" if artist.lower() == "justin bieber": break print("No way!") continue print("\n" + output) print("End of Favorites!")