Returning a Tuple in Python function
This function that I have written thus:
def simulate_turn(num_rolls, score, opponent_score):
"""This function takes in two scores and a number of die rolls and
returns
what the two scores would be if num_rolls many dice were rolled. This
takes
into account the swine swap, free bacon, and hog-wild."""
x = score
y = opponent_score
x +=
take_turn(num_rolls,opponent_score,select_dice(score,opponent_score))
if ifwillswap(x,y):
swap(x,y)
return x,y
When run in the interactive python shell (the function comes from a .py
file), it is returning an int object instead of a tuple! What am I doing
wrong? I am trying to have it turn a pair of values, not a single int
object.
No comments:
Post a Comment