+ 1

Sentinel Not working, HELP!

I need to append a name and a score, and have it print both and keep collecting the information until sentinel is entered but the sentinel is not working. Names = [] Score = [] Index = 0 Max = 0 size = 0 def showList(): print(Names,Score) while Names != 0: n = input("Enter players name: (Enter XXX to end) ") Names.append(n) s = input("Enter score: ") Score.append(s) print(Names) print(Score) if Names == 0: break showList

5th May 2020, 6:26 AM
Christian Sandoval
Christian Sandoval - avatar
7 Antworten
+ 1
A sentinel loop continues to process data until reaching a special value that signals the end. The special value is called the sentinel
5th May 2020, 6:35 AM
Christian Sandoval
Christian Sandoval - avatar
+ 1
Yes
5th May 2020, 6:37 AM
Christian Sandoval
Christian Sandoval - avatar
+ 1
but its not working
5th May 2020, 6:40 AM
Christian Sandoval
Christian Sandoval - avatar
0
Thank you
5th May 2020, 7:07 AM
Christian Sandoval
Christian Sandoval - avatar