[Tutor] how do i use p2exe

Eric tisza421 at gmail.com
Wed Nov 10 04:10:14 CET 2004


http://starship.python.net/crew/theller/py2exe/

Ok, im really new to programming and python.  Well anyway i made a
program for my classmates to help study vocabulary.  The only problem
is I dont want them to have to install python.  So i figure ill use
p2exe except i am pretty confused.  How do i do this, heres the
program if you need it.

import random

WORDS = ("derm", "ego", "erg, urg", "fact, fict, fect, fy")
ANSWERS = ("skin", "I, self", "work, power", "do, make")

amt = len(WORDS)

print "\tWelcome to the English 10 Vocabulary Quiz program!"
print "\t\\\\\\\\\\\\\\ \\\\ \\\\\\ \\\\\\\\\\\\\\ \\\\
\\\\\\\\\\\\\\\\\\\\ \\\\\\\\ \\\\\\\\\\\\\\\\\n"
print "There are three difficulty levels:\n"
print "\tLevel 1: 10 words\n\tLevel 2: 25 words\n\tLevel 3: All words"
print "\nYou will get a point for each word."
print "Try and beat your high score!"

diff = ""

while diff == "":
    diff = raw_input("\nWhich level: ")
    if diff == "1":
        wordamt = 10
    elif diff == "2":
        wordamt = 25
    elif diff == "3":
        wordamt = amt
    else:
        diff = ""

print "\nYou've picked level", diff, "."
print "You are going to be tested on", wordamt, "words.\n"

num = 1
pts = 0
tpts = wordamt

while wordamt > 0:
    guess = ""
    print "\n----- Word #", num, "-----"
    num += 1
    wordnum = random.randrange(amt)
    print "Q:", WORDS[wordnum]
    ansnum = random.randrange(len(WORDS))

    if ansnum == 0:
        print "A: 1.", ANSWERS[wordnum]
        print "   2.", ANSWERS[random.randrange(amt)]
        print "   3.", ANSWERS[random.randrange(amt)]
        print "   4.", ANSWERS[random.randrange(amt)]
    elif ansnum == 1:
        print "A: 1.", ANSWERS[random.randrange(amt)]
        print "   2.", ANSWERS[wordnum]
        print "   3.", ANSWERS[random.randrange(amt)]
        print "   4.", ANSWERS[random.randrange(amt)]
    elif ansnum == 2:
        print "A: 1.", ANSWERS[random.randrange(amt)]
        print "   2.", ANSWERS[random.randrange(amt)]
        print "   3.", ANSWERS[wordnum]
        print "   4.", ANSWERS[random.randrange(amt)]
    elif ansnum == 3:
        print "A: 1.", ANSWERS[random.randrange(amt)]
        print "   2.", ANSWERS[random.randrange(amt)]
        print "   3.", ANSWERS[random.randrange(amt)]
        print "   4.", ANSWERS[wordnum]
        
    while guess == "":
        guess = raw_input("What is your answer: ")
        if len(guess) > 1 or len(guess) < 1:
            guess = ""
            continue
        elif int(guess) != 1 and int(guess) != 2 and int(guess) != 3
and int(guess) != 4 and guess != "1" and guess != "2" and guess != "3"
and guess != "4":
            guess = ""
            continue
        elif int(guess) - 1 == ansnum:
            print "Correct!\n"
            pts += 1
            continue
        else:
            continue

    wordamt -= 1

pct = (float(pts) / float(tpts)) * 100
print "\nYou finished!  You got", pts, "out of", tpts, "which is", pct, "%!"

raw_input("\nPress enter to exit.")

Can someone give me a run through of how to use p2exe?  Thansk!

-- 
http://www.freeiPods.com/?r=7485183

Get a free ipod!  Actually works!


More information about the Tutor mailing list