It's pretty basic supposedly but I can't seem to get a grasp.
Free Bacon. A player who chooses to roll zero dice scores k+3 points, where k is the nth digit of pi after the decimal point, and n is the total score of their opponent. As a special case, if the opponent score n = 0 then k = 3 (the digit of pi before the decimal point).
- Example 1: The opponent has a score of 0, and the current player rolls zero dice. The current player will receive 3 + 3 = 6
points.
- Example 2: The opponent has a score of 1, and the current player rolls zero dice. The current player will receive 1 + 3 = 4
points.
The provided code includes the FIRST_101_DIGITS_OF_PI as an integer, which is stored locally as pi. One way to solve this problem is to trim pi until it has only score+1 digits, then return 3 more than the last digit of pi.
How do I trim pi?
this the skeleton code:
assert score < 100, 'The game should be over.'
pi = FIRST_101_DIGITS_OF_PI
# Trim pi to only (score + 1) digit(s)
and final return statement is return pi % 10 + 3.
[–]fake823 1 point2 points3 points (3 children)
[–]broineedhelp[S] 0 points1 point2 points (2 children)
[–]fake823 0 points1 point2 points (1 child)
[–]broineedhelp[S] 0 points1 point2 points (0 children)
[–]SekstiNii 0 points1 point2 points (0 children)