Question: i am haveing these errors TypeError: 'bool' object is not iterable File / tmp / test . py , line 7 7 ,
i am haveing these errors "TypeError: 'bool' object is not iterable" "File tmptestpy line in testShowVerifier
expected machineCorrect.showVerifierverifier
File tmpmachineCorrectpy line in showVerifier
verifierStr X if y else O for y in x for x in verifier
File tmpmachineCorrectpy line in
verifierStr X if y else O for y in x for x in verifier
The turn history output doesn't match! Pay careful attention to the spaces
We expected:
xyz A B C D E
O X X
O X X
X X X
But was:
xyz A B C D E
O X X
O X X
X X X # Probably should put a few functions hereabouts
def inputCardfilename:
with openfilenamer as a:
lines areadlines
b linesstrip
verifiers boolintnumber for number in line.stripsplit for line in lines:
return b verifiers
def getVerifierInputinput: str list:
character inputlowersplit
indices ordchars orda for chars in character
return sortedindices
def guessToIndexguess: int tuple:
with openverifierAddressinr as a:
lines areadlines
for line in lines:
guessvalue, x y line.stripsplit
if intguessvalue guess:
return intx inty
return None
def checkVerifiergameCard: tuple, guess: int bool:
verifiers gameCard
x y guessToIndexguess
return verifiersxy
def listCriteriagameCards: list str:
criteria "You have criteria
formatlengameCards
for index, gameCard in enumerategameCards:
criterion gameCard
criteria
formatchr index criterion
return criteriastrip
def showTurnHistoryguesses: list, history: list str:
headers xyz A B C D E
rows
for guess, res in zipguesses history:
row :dformatguess
row join if r else X if r else O for r in resrstrip
rows.appendrowrstrip
return headers
joinrows
def showVerifierverifier:
result
for row in verifier:
result.appendjoinX if cell else O for cell in rowstripn
return
joinresultrstrip
if namemain:
# This is not part of the tests, so you can use this
# to help check your code is working.
pass
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
