Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno
Options

Go back

Topic review (newest first)

Rick
2010-01-16 17:33:09

sorry... wrong language:

the error "<pyshell#4>" points to a print variable error

instead of:

print variable

use:

print str(variable)

I hope it can helps smile

Rick
2010-01-16 17:30:22

El error tipo "<pyshell#4>"es por error de impresion...

cambia el

print variable

que estes ejecutando por:

print str(variable)

debe funcionar, ojala te sirva

simron
2009-12-27 05:50:48

True, but that doesn't explain why it works on Windows, but not Mac.

Ricky
2009-12-26 02:48:15

Not a python programmer here, but it looks like day is declared locally instead of globally.  This means that it won't exist in other local routines.

simron
2009-12-25 06:44:26

Sorry to double post, but I noticed that a Windows machine with the same installation of Python doesn't have a single problem.

simron
2009-12-24 13:32:30

HELP!
I'm trying to make a Mafiya game in Python, but have run into problems. Here's what I'm worried about:

Code:

import random

def Start():
    day = 0 #This variable definition should work...
    DayTime()
...

Here's what I get when I run it:

Code:

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    Start()
  File "/Users/Rayment/Documents/Chase/games/Python/Mafiya!", line 5, in Start
    DayTime()
  File "/Users/Rayment/Documents/Chase/games/Python/Mafiya!", line 7, in DayTime
    day = day + 1;
UnboundLocalError: local variable 'day' referenced before assignment

I know that means that my variable definition is wrong, but it should be right. What gives?

Board footer

Powered by FluxBB