Support Forums

Full Version: Gambling Script Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hey guys.

I'm making a gambling script(will be posting it soon) but am i running against a problem.

error:
Code:
Traceback (most recent call last):
  File "C:\Python26\py2exe GUI\Kopie van gambling proto.py", line 217, in <module>
    print "You won by colour! Profit: "+rnwoncash
TypeError: cannot concatenate 'str' and 'int' objects

script part:
Code:
elif rnuserchosencolour==rnchosencolour:
            (line217)print "You won by colour! Profit: "+rnwoncash
                        rmoney+=rnwoncash
    (this last lines are to stop looping)
                        xxx-=1
                        rightnumberbet-=1
                        rightbet-=1
                        wrongin-=1


so can you guys help me?( rnwoncash is a number)
(10-19-2009, 09:20 AM)Mr.FeellingLeSS Wrote: [ -> ](line217)print "You won by colour! Profit: "+rnwoncash

Change the line to

Code:
print "You won by colour! Profit: ", rnwoncash

In Python you get a problem when you use "+" with 2 different types of data, since your var "rnwoncash" is integer you can't use "+" to add it to your string...
(10-19-2009, 09:24 AM)NinjaGeek Wrote: [ -> ]Change the line to

Code:
print "You won by colour! Profit: ", rnwoncash

In Python you get a problem when you use "+" with 2 different types of data, since your var "rnwoncash" is integer you can't use "+" to add it to your string...

thanks for the quick respone i will change it. PirateThumbsupBig Grin
(10-19-2009, 09:32 AM)Mr.FeellingLeSS Wrote: [ -> ]thanks for the quick respone i will change it. PirateThumbsupBig Grin

Blackhat
I'm here to help, and for the future please use the code tags when showing code snippets

Code:
[code]Your code [ /code](without the whitespace in the closing tag)
(10-19-2009, 09:35 AM)NinjaGeek Wrote: [ -> ]Blackhat
I'm here to help, and for the future please use the code tags when showing code snippets

Code:
[code]Your code [ /code](without the whitespace in the closing tag)

taken care of Thumbsup
Please don't change thread titles into nonsense.
since rnwoncash is an int, to concentrate it with a string you must turn it into a string.

Code:
print "You won by colour! Profit: " + str( rnwoncash )

should do
guys i got an other problem Gratte

Code:
import os
import platform
systemver=platform.release()
if systemver=='XP':
    clearer=os.system("cls")
elif systemver=='Vista':
    clearer==os.system("clear")
else:
    clearer==os.system("clear")
clearer
print "TEST TEXT"
clearer
print "TEST LTEXT"
raw_input("")

it won't clear, though i don't get a error...
it just skips clearer like it means nothing...
(10-20-2009, 10:06 AM)Mr.FeellingLeSS Wrote: [ -> ]it won't clear, though i don't get a error...
it just skips clearer like it means nothing...

It does clear on XP, what are you using Vista or 7?

EDIT:
aahhhh I got what you were trying to do, you are calling the variable "clearer" but that is the wrong way
try defining a function, try this:
Code:
import os
import platform

def clearer():
    systemver=platform.release()
    if systemver=='XP':
        os.system("cls")
    elif systemver=='Vista':
        os.system("clear")
    else:
        os.system("clear")

clearer()
print "TEST TEXT"
clearer()
print "TEST LTEXT"
raw_input("")
Thanks for the quick response Thumbsup

i see what i did wrong fixing it now Big Grin[/align]
Pages: 1 2