Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
I have a question about Python
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-28-2009, 05:03 PM
Newcomer
 
Join Date: Sep 2009
Posts: 1
Default 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:

Quote:
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:

Quote:
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

Last edited by Uzay : 09-28-2009 at 05:21 PM.
Reply With Quote
  #2  
Old 09-30-2009, 10:25 PM
Guru
 
Join Date: Jan 2007
Location: /home/Canada
Posts: 1,768
Default Re: I have a question about Python

Why isn't your code indented? It should have been when you used it with the interpreter...
Reply With Quote
  #3  
Old 10-01-2009, 12:06 AM
Legend
Java Programmers Pirate
 
Join Date: Jan 2007
Posts: 10,904
<3 n4n0
Default Re: I have a question about Python

Ummm....

Quote:
Oh shit
this
is
indended.
Quotes do not keep indentation.
__________________
PM me with any issues.

I do not MM or trade anything.
Anyone claiming to be me in a trade or MM is an imposter.

Last edited by SuF : 10-01-2009 at 12:06 AM.
Reply With Quote
  #4  
Old 10-02-2009, 08:10 PM
BANNED FROM MARKET

BANNED
 
Join Date: May 2005
Posts: 4,430
Default Re: I have a question about Python

Quote:
Originally Posted by SuF View Post
Ummm....



Quotes do not keep indentation.
Code tags do!

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()

Last edited by Daily : 10-02-2009 at 08:12 PM.
Reply With Quote
  #5  
Old 10-03-2009, 12:07 AM
Legend
Java Programmers Pirate
 
Join Date: Jan 2007
Posts: 10,904
<3 n4n0
Default Re: I have a question about Python

Yes they do. He just used quotes instead of codes. :P
__________________
PM me with any issues.

I do not MM or trade anything.
Anyone claiming to be me in a trade or MM is an imposter.
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1