How could the following code be adapted for a baseball score keeping?
1 def scoreUpdate(value) :
2 # update the score value with the points earned
3 return(value + 6)
4 def bonus(value) :
5 return(value +1)
6 score = 6
7 score = scoreUpdate(score)
8 print("after update " + str(score))
9 score = bonus(score)
10 print("after bonus "+ str(score))
Choose an answer from the options below.
1.Replace the 1 with a 2 in line 5.
2.Change the 6 to a 1 in line 6.
3.Change line 7 to call bonus instead.
4.Replace 6 with 1 in 3 and remove the bonus section
1 answer
The best adaptation for baseball score-keeping would be option 4: replace 6 with 1 in line 3 (since baseball scores are traditionally counted by 1s) and remove the bonus section altogether (as it is not typically used in baseball scoring).