jlm699 320 Veteran Poster

You're more likely to get help if you follow the posting guidelines for this forum, including but not limited to using code tags, showing effort, and providing simple examples of reproducible errors.

After skimming over your crazy long post I'll give you an example of asking the user for input and using it to open a file:

import os

usr_path = raw_input( 'Please provide the path of the file: ' )
if os.path.exists( usr_path ): # Check for file existing
    f = open( usr_path ) # Open for reading
    lines = f.readlines()   # Read in the contents
    f.close()                     # Close the file
else:
    print 'File does not exist'

HTH

jlm699 320 Veteran Poster

I am new to python.. iam having some confusion .. can you pls help me to do setup

I assume then, that you don't know what TRAC is, as it is not a Python module or anything. What exactly are you looking to do? What do you expect from TRAC?

Here is the setup/installation guide

jlm699 320 Veteran Poster

Yeah, sure thing. I don't know if generating it will be as easy as your zeros but here's an example:

>>> mtrx = [[(0,0),(0,1),(0,2),(0,3)],
...         [(1,0),(1,1),(1,2),(1,3)],
...         [(2,0),(2,1),(2,2),(2,3)],
...         [(3,0),(3,1),(3,2),(3,3)]]
>>> mtrx[2][1]
(2, 1)
>>> mtrx[2][1][0]
2
>>> mtrx[2][1][1]
1
>>>

HTH

jlm699 320 Veteran Poster

Have you followed the Guide with step-by-step instructions of how to setup and use TRAC?

There's a link to it right there on the first page.

jlm699 320 Veteran Poster

This is for an intro to computer science class. What I am trying to do is have N be the maximum number of flips that occur in one trial, and when coinflip achieves either htt or hth within N, trial one is complete, and so on. The x incrementing by 2 was a typo I left in by accident to see if that would fix the issue, it should be x += 1.

Is this at Penn State? I feel like I've tried this assignment in the past, only in a different language...

Have you implemented any of the changes I mentioned above? How goes your progress? Do you understand my points, or do you need further explanation?

EDIT: Oh wow, I also just noticed that you have two return statements in your module's function... that is incorrect, as once the first return statement is encountered the function will exit immediately. The second return statement never happens.

jlm699 320 Veteran Poster
N = int(raw_input('Welcome to the HTH-HTT Head-to-Head!  How many times do you want to flip the coin per trial? I recommend at least 20: '))

trials = int(raw_input('How many trials do you want to run?: '))

while x < trials:
    coinflip.htthth(N)
    if coinflip.htthth('hthCount') == 1:
        hth += 1
        x += 2
    elif coinflip.htthth('httCount') == 1:
        htt += 1
        x += 2

You're asking the user for their input twice, as to how many times to flip the coin. That's your first problem.

In this main program you're using trials as your count but then passing N to the function htthth.

All told, on each iteration of your while loop you're running coinflip.htthth() three times... Well actually both conditions check for the return to be equal to '1', which doesn't make much sense. Why is that? (I guess it makes sense as to why you're incrementing x by 2 each time) If you're trying to evaluate the return of that function you should do something like this:

rtn = coinflip.htthth(N)
if rtn == 1:
    # This is the action for a return of 1
elif rtn == 0: # Something OTHER THAN 1
    # This is the action for a return of 0

I hope that makes sense. Right now you're calling the function coinflip.htthth and passing it either 'hthCount' or 'httCount', which are strings. That function wants a number.

If the function does the looping for you, then you do not need to use a …

jlm699 320 Veteran Poster

If you simply double click on a .py or a .pyw icon Python will open and run the script in a command window, just as vega mentioned above...

Keep in mind however that if your program has bugs and crashes, the command window will close as soon as Python is done executing and you'll lose the traceback.

jlm699 320 Veteran Poster

Yeah I think split() would probably be your best bet. Either that or replace :

>>> some_text = '"http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun at police from his car in Paekakariki, north of Wellington, this morning.\r\n\r\nWhen police approached his vehicle on Paekakariki Hill Rd after receiving a call over...)\r\n'
>>> for each_line in some_text.split('\r\n'):
...     if each_line: print each_line
...     
"http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun at police from his car in Paekakariki, north of Wellington, this morning.
When police approached his vehicle on Paekakariki Hill Rd after receiving a call over...)
>>>
>>>
>>> some_text.replace('\r\n', ' ')
'"http://www.nzherald.co.nz/nz/news/article.cfm?c_id=1&objectid=10568455&ref=rss" Man arrested after pointing fake gun at police (A 59-year-old man has been arrested after pointing an imitation gun at police from his car in Paekakariki, north of Wellington, this morning.  When police approached his vehicle on Paekakariki Hill Rd after receiving a call over...) '

Hope that helps

EDIT: Note that I used if each_line: in the for loop method because when Python split() the double \r\n there was a 'nothing' between them. So that will show up in your list still...

jlm699 320 Veteran Poster

You've got to post the code where principal comes from. It would seem that principal is a list instead of a number... here look at this example of generating that error:

>>> [ 1,2,3,4] * 0.02
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: can't multiply sequence by non-int of type 'float'
>>>
jlm699 320 Veteran Poster

Use code tags

jlm699 320 Veteran Poster

Sure, we can help! Just remember to follow the forum rules, and pay attention to the posted announcements (here and here), and there won't be any problems.

This post by vegaseat should get you started...

Nick Evan commented: That'll do +16
jlm699 320 Veteran Poster

If a call to the DLL returns '2' then that's not a Python error code, that's just what the DLL is returning. I'd suggest using the DLL in another language in the same way to see if you get the same error code.

jlm699 320 Veteran Poster

When using code tags, you should use [code=python] instead of [code=syntax].

In your code, you do a few things incorrectly. First of all, you shouldn't define functions within other functions. So move those back out a level and take them out of main() . Either that or don't use functions, since neither of those functions actually perform anything at all.

The main problem here is that your principal_data function does not return any values. This means that on the line that reads principal = principal_data , principal is getting assigned a value of None , which is why you're experiencing your fail.

jlm699 320 Veteran Poster

Thanks to both replies, I just need help from more experienced python users as of where and how to find education materials to help me writing the codes, I am not expecting you guys to do it for me.

Thanks again

Here

If you spent five seconds googling any one of those search methods you'd already have pseudo-code for each and every one.

jlm699 320 Veteran Poster

You'll have to adapt your code to the website's new layout/API/whatever. Maybe you could provide more details and a little code so that we have some idea of what you're talking about.

jlm699 320 Veteran Poster

You'll have to write those sort algorithms yourself. Or search google. To sort a list in Python:

my_list = [1,5,2,8,3,4,7,6]
my_list.sort()
jlm699 320 Veteran Poster

Just put it like so

CODE GOES HERE
CODE
CODE
CODE

put non-code stuff here

This is for when you post code in the forum. It allows us other members to read your code very easily, as it doesn't come out in a jumbled mess like above. It will have nice formatting and syntax highlighting to help us solve your problems!

jlm699 320 Veteran Poster
height = principal * 0.02
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

0.02 is your float and * is your operand. That only leaves principal to be your NoneType. At another point, you are setting principal equal to the return value of a function that doesn't return anything. That's your problem.

Slight correction to your explanation... '*' is your operator and 0.02 and principal are your operands, of type float and NoneType respectively. The remainder I agree with.

jlm699 320 Veteran Poster

Here's a working version of the classed code from above (I incorporated adam's suggestions from above and modified some behavior slightly):

import Tkinter as tk
import time

class stopwatch( object ):
    def __init__(self, parent, *args, **kwargs):
        self.parent = parent
        self.count_flag = False
        canvas = tk.Canvas(self.parent, *args, **kwargs)
        canvas.pack()
        # create needed widgets
        self.counter = tk.Label(self.parent, text='0.0')
        btn_start = tk.Button(self.parent, text='start', command=self.start)
        btn_stop = tk.Button(self.parent, text='stop', command=self.stop)
        # use a grid to place the widgets
        canvas.grid(row=0, column=0, columnspan=2)
        self.counter.grid(row=0, column=0, columnspan=2)
        btn_start.grid(row=1, column=0, padx=5, pady=5)
        btn_stop.grid(row=1, column=1, padx=5)

    def start(self):
        self.count_flag = True
        count = 0.0
        while self.count_flag:
            # put the count value into the label
            self.counter['text'] = str(count)
            # wait for 0.1 seconds
            time.sleep(0.1)
            # needed with time.sleep()
            self.parent.update()
            # increase count
            count += 0.1

    def stop(self):
        self.count_flag = False

def main():
    # create a Tkinter window
    root = tk.Tk()
    sw = stopwatch( root, width=50, height=40, bg="#A3A3A3" )
    # start the event loop
    root.mainloop()

if __name__ == '__main__':
    main()
jlm699 320 Veteran Poster

Please use code tags when posting code.
[code=python] # Put your code inside here

[/code]

As far as Python input methods you can use raw_input to prompt the user for input:

usr_inp = raw_input( 'Please enter a directory: ' )
print 'The user entered:', usr_inp
jlm699 320 Veteran Poster

i want to integrate the above code in this tkinter a window but its not working.

What's not working? Are you getting an error? Your "tkinter a window" doesn't work for me. It never generates any windows and just hangs, so I'm not sure what you're looking for.

jlm699 320 Veteran Poster

I think that you overlooked what adam was saying in his first post. If two straight lines are not parallel and are not the same line, then they must intersect as some point.

Unless you need to figure out the exact point of intersection, you can simply use if-else logic here.

jlm699 320 Veteran Poster

thanks, that's a good start for now, but eventually it would be nice to do

--files *.txt --Size 4.2 --Duration 5

Dave

I'm not entirely clear on what you're trying to do, but if you want to get all files in a directory that are *.txt you can use the glob module:

>>> import os,glob
>>> os.chdir('C:\\Documents and Settings\\Administrator\\Desktop')
>>> my_files = glob.glob('*.py')
>>> my_files
['batt.py', 'newt_root.py', 'perf_num.py', 'template.py']
>>>

EDIT: I'm sure that you're not actually restricted to a single directory since you can probably use wild cards for the directory too. I think glob just expands exactly the way that Unix path expansion works.

HTH

jlm699 320 Veteran Poster

Also, how do you handle required options? I saw a lot of threads about a philosophical debate of if options can be required, but no information on how to actually use them.

Dave

This is from the optparse doc:

required option
an option that must be supplied on the command-line; note that the phrase “required option” is self-contradictory in English. optparse doesn’t prevent you from implementing required options, but doesn’t give you much help at it either. See examples/required_1.py and examples/required_2.py in the optparse source distribution for two ways to implement required options with optparse.

jlm699 320 Veteran Poster

Why simple! Convert your values to decimal and then back to binary after doing the masking!

If you're using Python 2.6 or 3.0 you can make use of the bin() and int() conversions to make this super easy.

jlm699 320 Veteran Poster

right jlm, except the whole point of the loop is testing different numbers to see if they're perfect... like testing 1, then a +=1, or 2, then 3, etc.

My first advice to FIX your code, was to clear the contents of b when you move onto a new a since it won't have the same factors.

I understand the point of the loop, as I have your program working on my system. Do you have it working yet? Didn't think so. Maybe you misunderstood what I was suggesting. I said to move it outside of the for loop, not the while loop.

You're testing different numbers using a , which is incremented at the end of the while loop. The for loop is used to get all the factors of a and append them to b . So I suggested moving the sum(b) and subsequent perfect number check to after the for loop to save processing time.

As it stands now, every time you find a factor of a you append it to b and check to see if the contents of the array are twice the original number even though you haven't completed finding all factors.

EDIT: Oh, and when doing a comparison you have to use == , not = , as the single equals sign is for assignment.

jlm699 320 Veteran Poster

Actually the more I try to get this code working the more I realize that you might be confusing your variable names.... you're iterating over guess in your for loop, but then also using it afterwards to say what the final guess was... which will always be the last value of the for loops iteration. So on a range(1,15) call, guess will start at guess = 1 , then on the next iteration it'll be guess = 2 , then guess = 3 , and so on until it becomes guess = 14 to end the loop.

Also, you never convert the "number of times" that the user enters to a number, you're leaving it as a string... try to wrap that input with a call to int() I also should re-state that you need to re-think the way you're casting your floats... instead of the following:

for guess in range (1, i):
        float((float(x / guess) + guess) / 2)

    answer = float(math.sqrt(x))
    check = abs(float(guess - answer))

You should have these lines:

for some_value in range (1, i):
        guess = ((x / guess) + guess) / 2

    answer = math.sqrt(x)
    check = abs(guess - answer)

And one last thing: You should use raw_input instead of input (if this is a 2.X version of Python). Check what happens if the user enters 4 * 5 into an input() prompt and then think about what would happen if they entered any malicious code....

jlm699 320 Veteran Poster

So, apparently the for statement makes my guesses worse. Thanks in advance

Look at what range(15) and range(1,15) produce:

>>> range(15)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
>>> range(1,15)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
>>>

You're leaving off the number 15 (if that's what you were shooting for).

Now just out of curiosity, what is the purpose behind your for loop? As it stands, it isn't doing anything. It's simply doing some arbitrary calculations but never updating any values or storing any results.

Also, what's with the multiple float casting? Only one operand needs to be a float in order to invoke true division in Python < 3.0 ... that means you could simply put guess = float(guess) before the calculation line and remove all float casting and achieve the same output. **EDIT** Actually, I just checked and it's actually waaay more accurate to remove that float casting and simply use guess = float(guess) followed by result = ((x / guess) + guess) / 2 .

jlm699 320 Veteran Poster

Here, I don't think you understood what I was saying. I updated your code to slightly reflect the way that I would write it...

import random, textwrap

cho = '\t1.Attack'
att = 'You attack!'

def get_ran():
    random.seed()
    return random.randrange(10)

def bat_sta( hp ):
    print cho
    des = int(raw_input(' \tPick! '))
    if des == 1:
        ran = get_ran()
        cran = get_ran()
        deth = get_ran()
        #print 'Ran:',ran,'Cran:',cran,'Deth:',deth
        print textwrap.fill(att)
        if (ran == cran and ran > 0):
            print 'Critical hit! %i points of damage!' % (cran * 2)
            hp -= ran * 2
        elif ran == 1:
            print 'Your attack does 1 point of damage!'
            hp -= ran
        elif ran > 1:
            print 'Your attack does %s points of damage!' % ran
            hp -= ran
        elif ran == 0:
            print 'Your attack didn\'t do anything!'
        print 'Enemies hp: %i' % hp
        if hp == 0:#(ran == cran and cran == deth):
            print 'You killed it!'
    
    return hp


if __name__ == '__main__':
    hp = 100
    while True:
        hp = bat_sta(hp)

Please ask about anything you don't understand

jlm699 320 Veteran Poster

Do you mean a binary number with 24 bits or an integer with 24 digits?

jlm699 320 Veteran Poster

I suggest verifying your login method line-by-line in the interpreter before implementing into the function.

Adding the event is simply a requirement that gtk enforces. Any method bound to a button press or key stroke will need to accept an event as input.

jlm699 320 Veteran Poster

The "built in" module would be Tkinter, but if you're looking for something simple that will generate native-looking GUIs with minimal effort I would suggest wxPython.

There's a wealth of tutorials and sample code in this forum that you are welcome to use (refer to the sticky wxPython samples thread on the first page).

jlm699 320 Veteran Poster

You need to change the definition of con() to support the event details that get automatically passed to any bound method.

The new definition should look like this:

def con(self, event=None):

Note that I initialized event to None so that you can still call it yourself without needing to supply an event class.

jlm699 320 Veteran Poster

You use print to print anything in Python. Since your functions are returning values, you can use print to output those values.

jlm699 320 Veteran Poster

Well first problem is that you're never clearing the contents of your list b . Also, you should move the summation of b outside of the for loop so that it only happens once you've found all the factors of the desired number... That should get you pointed in the right direction.

jlm699 320 Veteran Poster
def fibonacci(a,b,n):
   a =a+b
   b = a+b
   n= n-2
   if n ==0:
      print b
      return b
   elif n ==1:
      print a
      return a
   else:
      fibonacci(a,b,n)

x = fibonacci(1,1,7)
print x

i get none as the x value but a legitimate integer as the a or b value, and i don't know why.

So a = a + b , and b = a + b , which means they are equal. Then you evaluate whether n == 0 or n == 1 and return either b or a respectively.

I think you need to re-check your logic.

jlm699 320 Veteran Poster

The problem is that since you have elif guesscount == 4: as a condition in an if/elif/else block, it never gets evaluated. The first two conditions are absolute:

if guess in word:
    print 'Yes'
elif guess not in word:
    print 'No'

The user's choice is either going to be present or not present... there is no possibility for the computer to evaluate past the guess not in word condition. Do you understand why?

I modified your code slightly as follows:

import random
print "Hello President Bush, I will give you 5 chances to guess letters of one of my secret words.\n On the final chance, you must guess the word"
WORDS = ("bush", "usa", "war", "oil", "iraq", "osama", "alla")

word = random.choice(WORDS)
print "The password is", len(word), "letters long."

guesscount = 0
while guesscount <= 4:
    guesscount += 1
    guess = raw_input("guess a letter: ")
    if guess in word:
        print "yes"
    elif guess not in word:
        print "no"
    elif guess == " ":
        print "no"

print "You have to guess the presidents passcode"
guess_word = raw_input("Input code: ")
guess_word = guess_word.lower()

if guess_word == word:
    print "The CIA are already at your house!\n President never gets it on the first try..."
elif guess_word != word:
    print "President Bush did you forget your password again..."

As you can see I just used the while loop to keep track of the number of guesses and moved the word guess to after the loop.

jlm699 320 Veteran Poster

say you have list a = [2,4,6,8,10]
and list b = [2,6,10,12]

is there any way to make a list c show all the ones they have in common? so list c = [2,6,10] ?

Use sets and then convert back to list and sort() to get it ordered.

>>> setA = set([2,4,6,8,10])
>>> setB = set([2,6,10,12])
>>> rtn = list(setA.intersection(setB))
>>> rtn.sort()
>>> rtn
[2, 6, 10]
>>>

HTH

jlm699 320 Veteran Poster

my apologies, once again i've found the answer before anyone could reply

x = []
for n in range(5):
    x.append(n)

You're taking the long way here. Look:

>>> x = range(5)
>>> x
[0, 1, 2, 3, 4]
>>>
jlm699 320 Veteran Poster

You should be using return values instead of global variables... see if this makes any sense, and if not ask questions.

>>> import random
>>> def get_ran():
...     return random.randint(1,10)
...     
>>> get_ran()
5
>>> get_ran()
10
>>> get_ran()
4
>>> hp = 100
>>> hp -= get_ran()
>>> hp
97
>>> hp -= get_ran()
>>> hp
87
>>> hp += get_ran()
>>> hp
95
>>>
jlm699 320 Veteran Poster

I'm sorry can you provide more detail? Your question isn't exactly clear...

jlm699 320 Veteran Poster

Yes it depends on your input data. If a line already has a newline character at the end ('\n') and you append a newline with line9 = line9+'\n' then your resulting data will have two newlines, which will print out as such:

>>> line9 = 'This is a test line\n'
>>> line9 = line9 + '\n'
>>> print line9, 'This is another line'
This is a test line

This is another line
>>>

Hope that helps

jlm699 320 Veteran Poster

Hi, there

I already sorted it by using the code

for line9 in resultlines:
                line9=line9.strip()
                line9=line9+"\n"
                binf.write(line9)

thanks.

ning

I would suggest a slight modification to your code:

for line9 in resultlines:
        line9=line9.strip()
        if line9:
            line9=line9+"\n"
            binf.write(line9)

In its current form, even if you encounter a blank line, you'll append a newline and then write it to file... I thoght you were trying to remove blank lines? Anyway I'm glad you've found a solution

jlm699 320 Veteran Poster

Here's a way to avoid printing the empty line:

for line in my_text:
    line = line.strip()
    if line:
        print line
    # The 'else' condition here is an empty line, which we don't print
jlm699 320 Veteran Poster

also you might want to add a return function(

import time

def main():
    a = 0
    while True:
        print (a)
        time.sleep(5)
        a += 1
        return a
    
main()

This will exit the main function on the first iteration of the while loop. I would suggest that you do not do this.

jlm699 320 Veteran Poster

You need to stop recursing your main function, it's going to get you in trouble. Here's an example using a while loop.

import time

def main():
    a = 0
    while True:
        print (a)
        time.sleep(5)
        a += 1
    
main()

EDIT: I didn't notice the other thread about this same problem, in which it is already solved.

jlm699 320 Veteran Poster

how to compile and run a python file,and how to change a directory in Python25.what should i import first in order to run a python code.like import math and ......

If you are trying to run a python script that is titled my_script.py from the command line (you could alternately double-click the icon but you won't be able to catch any errors), do the following:

# Change into directory containing your script
C:\Python25\python.exe my_script.py

Now this can be greatly simplified if you add C:\Python25 to your PATH variable. There was a post yesterday about doing just. Once that directory is in your PATH you can simply perform python my_script.py Also for changing directories within Python you want the os module, here's an example:

>>> import os
>>> os.getcwd() # Returns the current working directory
'C:\\Python25\\Lib\\site-packages\\wx-2.8-msw-ansi\\wx\\py'
>>> os.chdir( 'C:\\Documents and Settings\\Administrator\\Desktop' )
>>> os.getcwd()
'C:\\Documents and Settings\\Administrator\\Desktop'
>>> os.listdir( '.' )
['787099A0.219.wd_running.zip', '79950653.826', 'BladeGold.lnk', 'ChassisGold.lnk', 'Clearquest user manual reve.ppt', 'condor_cmds.doc', 'double click on this icon if notes crashes.exe', 'Finances.xls', 'mortgage.txt', 'portals.py', 'SystemX.lnk', 'template.py', 'Things I never Use', 'tkUpdate.py']
>>>
jlm699 320 Veteran Poster

how to split a string of words into pieces

Use the split() method like so:

>>> my_phrase = "the sun is shining"
>>> my_phrase.split()
['the', 'sun', 'is', 'shining']
>>>

and print on separate lines

As you can see from above, split() returns a list containing each word as an element. I'm going to store this list and then iterate over it with a for loop. On each iteration the value of each_word will update with the next element from my_split_words . Refer to the following:

>>> my_split_words = my_phrase.split()
>>> for each_word in my_split_words:
...     print each_word
...     
the
sun
is
shining
>>>

I hope that clears up what each step does. Please let us know if you need anything explained further.

jlm699 320 Veteran Poster

so this will be about as simple as you can make a loop:

def main():
    print ("I'm the main function!")
    main()

main()

That isn't ideal as you're making it a recursive function. I think this would be the easiest way to make a loop:

def main():
    print ( "I'm the main function!" )

while True:
    main()

You could also dictate a particular number of times to run the main function like this with a for loop:

def main():
    print ( "I'm the main function!" )

num_loops = 15
for i in range( num_loops ):
    main()
jlm699 320 Veteran Poster

Here I was able to cut out over 150 lines of code by using the above method and using a list instead of individual position variables:

from Tkinter import *
import Tkinter
import random
import tkMessageBox

##Player positions
positions = [0,0,0,0]

def rollDice(num, sides):
    try:                    
        int(num)                ##Attempt to force num to Integer form.
        int(sides)              ##Attempt to force sides to Integer form.
        if num <= 0 or sides <= 0:
            raise Exception()    ##Raise exception flag when num or sides is < 1
    except Exception:          ##Handle Exception flag.
        handleError("The 'num' and 'sides' argument must be positive integers.")
        return [-1]             ##Return list of -1 when an error occurs.
    rolls = []                 ##Set rolls to be an empty list.
    currRoll = 1               ##Variable for keeping track of which die roll we are on.
    while currRoll <= num:     
        rolls.append(random.randint(1,sides))  ##Rolls the die and adds the result to the end of the list 'rolls'.
        currRoll += 1           
    return rolls               ##Return the list containing 'num' dice rolls.

##asks how many humans will play
def Num_Humans ():
    print '\nHow many human players will play?'
    Humans = input ('Please enter a number 1-4: ')
    while Humans != 1 and Humans != 2 and Humans != 3 and Humans != 4:
        print '\nincorrect input please enter a correct input'
        print '\nHow many human players will play?'
        Humans = input ('Please enter a number 1-4: ')

def orderDie(player):
    Die=rollDice(1,6)[0]
    global positions
    positions[player]+=Die
    tkMessageBox.showinfo( "Order Die for user %s" % player, Die )
    print "Player %s's postion is" % player, positions[player] …