i just started coding in Python. I have no prior experience in any other programming language so i hope this forum will be a great place for me to learn about coding! so here it is:
import random
bankroll = 10
bankroll2 = 10
def player():
player1 = random.randrange(0, 5)
player2 = random.randrange(0, 5)
if player1 > player2:
print "Player 1 throws a :", player1
print "Player 2 throws a :", player2
print "Player 1 Win"
bankroll + 1
bankroll2 -1
print bankroll
print bankroll2
elif player1 < player2:
print "Player 1 throws a :", player1
print "Player 2 throws a :", player2
print "Player 2 Win"
print bankroll
print bankroll2
else:
print "Player 1 throws a :", player1
print "Player 2 throws a :", player2
print "It's a tie!"
print bankroll
print bankroll2
print ""
player()
player()
player()
player()
player()
player()
player()
right now the bankrolls are always restarting to 10, i understand why but i don't know how to avoid it. My goal is to keep track of the bankroll.
If anyone could point me in the right direction it would be greatly appreciated.