guessesRemaining=12
Summary=[]
code=['1','2','3','4']
while guessesRemaining > 0:
report=[]
guess=validateInput()
guessesRemaining -= 1
if guess[0] == code[0]:
report.append("X")
if guess[1] == code[1]:
report.append("X")
if guess[2] == code[2]:
report.append("X")
if guess[3] == code[3]:
report.append("X")
tempCode=list(code)
tempGuess=list(guess)
if tempGuess[0] in tempCode:
report.append("O")
if tempGuess[1] in tempCode:
report.append("O")
if tempGuess[2] in tempCode:
report.append("O")
if tempGuess[3] in tempCode:
report.append("O")
ListCount=report.count("X")
if ListCount > 0:
del report[-ListCount:]
report2=report[0:4]
dash=["-","-","-","-"]
report2=report+dash
report3=report2[0:4]
report4="".join(report3)
guess2="".join(guess)
Summary+=[guess2,report4]
print(Summary)
The validateInput() calls a function which I didn't add here. I'm trying to figure out how to print my results one line at a time throughout the course of the 12 guesses. Through three guesses I recieve...
['4715', 'OO--', '8457', 'O---', '4658', 'O---']
when I want to recieve...
['4715', 'OO--']
['8457', 'O---']
['4658', 'O---']
I've tried to add in \n in multiple ways but I can't figure out how to implement it. Any and all help is much appreciated.