Reputation: 17
def simple_game():
total = 0
for i in range(0,10):
if pick() % 13 != 0 :
total = total + pick() % 13
else:
total = total // 2
return total
after generating a random number (function not shown above), player's score will be reduced by half if the number is one of 13, 26, 39. Or else, it will be increased by the number%13.
What is wrong with this function?
Upvotes: 0
Views: 65
Reputation: 818
You more than likely need to set a variable for the return value of pick(). As if stands now its getting called every time within the for loop.
Upvotes: 1
Reputation: 9946
it's probably in pick
. if that's where you get your random number, you call it twice, thus getting two (probably) different results.
Upvotes: 3