View Single Post
Old Jun 10th, 2006, 9:47 PM   #1
python
Newbie
 
Join Date: Jun 2006
Posts: 7
Rep Power: 0 python is on a distinguished road
Dice Game error HELP plz

Here is the code:

print "Welcome to RoyalSoftware Main system"
print "Login to use"

usrname = raw_input("What is your username: ")

if usrname == "treymonty":
print "Welcome, " + usrname
psswd = raw_input("Enter your password: ")

if psswd == "password":
print "Welcome to RoyalSoftware"

print """
RoyalSoftware Menu
1 - Game
2 - Directory
3 - Info/Credits
4 - Source Code
"""
choice = raw_input("Choice: ")
if choice == "1":
import random
print "Die Roller"
print "RoyalSoftware"
raw_input("\n\nPress enter to roll")

die1Human = random.randrange(6) + 1
die2Human = random.randrange(6) + 1
die3Human = random.randrange(6) + 1
die4Human = random.randrange(6) + 1
die5Human = random.randrange(6) + 1
die6Human = random.randrange(6) + 1
die1Computer = random.randrange(6) + 1
die2Computer = random.randrange(6) + 1
die3Computer = random.randrange(6) + 1
die4Computer = random.randrange(6) + 1
die5Computer = random.randrange(6) + 1
die6Computer = random.randrange(6) + 1

print usrname + " rolled a", die1Human,"and a", die2Human,"."
print "The computer rolled a", die1Computer,"and a", die2Computer,"."
if die1Human + die2Human > die1Computer + die2Computer:
print "You won!"

if die1Human + die2Human < die1Computer + die2Computer:
print "You lost!"

raw_input("\nPress enter to roll")

print usrname + " rolled a", die3Human,"and a", die4Human,"."
print "The computer rolled a", die3Computer,"and a", die4Computer,"."
if die3Human + die4Human > die3Computer + die4Computer:
print "You won!"

if die3Human + die4Human < die3Computer + die4Computer:
print "You lost!"

raw_input("\nPress enter to roll")

print usrname + " rolled a", die5Human,"and a", die6Human,"."
print "The computer rolled a", die5Computer,"and a", die6Computer,"."
if die5Human + die6Human > die5Computer + die6Computer:
print "You won!"

if die5Human + die6Human < die5Computer + die6Computer:
print "You lost!"

raw_input("\nPress enter to see the final score!")

humanScore = die1Human + die2Human + die3Human + die4Human + die5Human + die6Human
computerScore = die1Computer + die2Computer + die3Computer + die4Computer + die5Computer + die6Computer

print usrname + "'s final score is " + humanScore
print "Computer's final score is " + computerScore

if humanScore > computerScore:
print "You Won!"

if humanScore < computerScore:
print "You Lost!"






if choice == "2":
print "Coding terms Dictoary"


if choice == "3":
print "Credits and Information"
print
"""
RoyalSoftware inc.
We make your software.

RoyalSoftware Core net by'
Trey Montgomery
"""

if choice =="4":
print "it will not be here for a while"

here is the error:
Traceback (most recent call last):
File "C:\Python24\RoyalSoftware", line 73, in -toplevel-
print usrname + "'s final score is " + humanScore
TypeError: cannot concatenate 'str' and 'int' objects

I get this when I am trying to see the final score of the dice game

HELP plz
python is offline   Reply With Quote