• Log in or sign up for an account here: https://www.sythe.org/login

I have a question about Python

Uzay

Newcomer
Joined
Sep 28, 2009
Sythe Gold
0
Messages
1
I have a question about Python
Hello Guys,

I'm Uzay. I'm here to ask you something about Python. I want to write a programm about the game "Craps". This are the rules:

o 1st roll, a score of 7 or 11 wins.
o 1st roll, a score of 2, 3, or 12 loses.
o 1st roll, any number other than those listed above becomes the goal number, you must keep rolling until you roll the goal number again. If a 7 is rolled before you goal number, you lose.

Here is the site for "Craps":

I have the basic code already written, I want to add now bet odds and my question is how and can you help me?

For information, I am using Python 2.5

Here is my code:

LOST = 1
WON = 2
POINT = 3

dice1 = 0
dice2 = 0
sum = 0
last_throw = 0
status = 0

import random

print "Craps"
print "Welcome to the dice game Craps"

dice1 = random.randint(1,6)
dice2 = random.randint(1,6)
sum = dice1 + dice2
if sum == 7 or sum == 11:
status = WON
print "You Won"
else:
if sum == 2 or sum == 3 or sum == 12:
status = LOST
print "You lost"
else:
status = POINT
print "Continue"
print dice1, dice2, sum
while status == POINT:
print "New Litter"
dice1 = random.randint(1,6)
dice2 = random.randint(1,6)
sum = dice1 + dice2
print dice1, dice2, sum
if sum == POINT:
status = WON
print "You won"
else:
if sum == 7:
status = LOST
print "You lost"
else:
status = POINT
print "Continue"

Thanks for your help!

~Uzay
 
I have a question about Python
Why isn't your code indented? It should have been when you used it with the interpreter...
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
I have a question about Python
Ummm....

Oh shit
this
is
indended.

Quotes do not keep indentation.
 
I have a question about Python
Ummm....



Quotes do not keep indentation.

Code tags do! :D

Code:
#Student Name: Nick Moses
#Date Started: September 29, 2009
#Purpose: To convert text to ascii.
import string

def convert():
    message = "Python SUCKS ASS"
    print message
    for ch in message:
        print ord(ch),
        print

def endOfProgram():
    endofprogram = raw_input("Please hit enter to exit this program.")
    
def main():
    convert()
    endOfProgram()
    

    
main()
 
<3 n4n0
Discord Verified
Two Factor Authentication User
Community Participant
Spam Forum Participant
Sythe's 10th Anniversary
Sythe Awards 2011 Winner
I have a question about Python
Yes they do. He just used quotes instead of codes. :P
 
Runescape Gamblingrunescape gambling
Back
Top