Coding in Python. Here is the error code I receive based off my test. Can you fi
ID: 3722075 • Letter: C
Question
Coding in Python. Here is the error code I receive based off my test. Can you fix my code for the spacing issues?:
AssertionError: THE WINNER IS: Ziggy ! ! ! ! ! ' != THE WINNER IS: Ziggy ! ! ! FAIL: test_play_turn (__main__.TestConditions) Traceback (most recent call last): File "/Users/taylorchambers/Documents/ISTA_130/Homework/Homework 4/test_ pig.py", line 84, in test_play_turn " Points: 10 ", buf.getvalue)) Henry's turn AssertionError: " [96 chars]10 "-" oll[106 chars]10 " nlt > Points: 10 + Points: 10Explanation / Answer
If this code not work in your pc . please tell me your python version which you are using.
def print_scores(name1, score1, name2, score2):
name1=str(name1)
name2=str(name2)
print('--- SCORE ', name1, ': ',score1, ' ', name2,':',score2,'---')
return None
def check_for_winner(name, score):
if score >= 50:
print("THE WINNER IS:",name,"!!!!!")
return True
else:
return False
def roll_again(name):
a = input('Roll again? (Y/N) ')
while a!= 'Y' and a != 'y' and a != 'N' and a != 'n':
print('I don't understand"', name,'", Please enter either "Y" or "N".')
a=input('Roll again? (Y/N) ')
if a == 'Y' or a == 'y':
return True
elif a == 'N' or a == 'n':
return False
def play_turn(name):
n = 0
print('--------', name,"'s turn",'---------')
i = random,randint(1,6)
if i != 1:
n = n+i
print(' <<<', name, 'rolls a',i,'>>>)
print(' Points:',i)
else:
print(' !!! PIG! No points earned, sorry', name)
pirnt('(enter to continue)')
while roll_again(name):
i = random, randint(1,6)
if i != 1:
n = n + i
print(' <<<', name, 'rolls a', i, '>>>')
print(' Points:',n)
else:
print(' !!! PIGPIG! No points earned, sorry', name)
n = 0
input('(enter to continue)')
print()
return n