I am having trouble correcting the syntax on this problem so far and I can't seem to find my mistake any ideas on what I am doing wrong ? The object of the program is to ask user for amount of money to put in the pot, and play until the pot is empty.

import random

mypot = int(input("Please enter the amount of money you want in the pot: "))
diceroll1 = random.randit(1, 7)
diceroll2 = random.randit(1, 7)
myrole = (diceroll + diceroll2)

if myrole == 7:
print("Your roll was a 7 you eaerned: ", mypot + 4)
else:
print("Your roll was not a seven you lost: ", mypot - 1)

Hard to check your syntax unless you put your code in code blocks because we can't see the indents. Change 'random.randit' to 'random.randint' x 2. Change 'myrole = (diceroll + diceroll2)' to
'myrole = (diceroll1 + diceroll2)'
As written this will not play until the pot is empty. Consider adding

while mypot > 0:
   # code here

a little proofreading will solve a lot of your problems.

Edited 4 Years Ago by ihatehippies: n/a

You should also check for values between a certain range, i.e. someone can not enter one million or a letter.

Edited 4 Years Ago by woooee: n/a

import random

mypot = int(input("Please enter the amount of money you want in the pot: "))
diceroll1 = random.randint(1, 7)
diceroll2 = random.randint(1, 7)
myrole = (diceroll1 + diceroll2)
while mypot > 0:
if myrole == 7:
print("Your roll was a 7 you eaerned press enter to roll again: ", mypot + 4)
break
else:
print("Sorry you did not roll a 7 press enter to roll again: ", mypot - 1)
break

how can i get the loop to repeat until my pot == 0

"break" stops your loop, without it your loop will run until mypot <= 0. That's btw the next problem, the value for mypot doesn't change and it will loop for a long long time.

This article has been dead for over six months. Start a new discussion instead.