woooee 814 Nearly a Posting Maven

If you can call/execute external programs, then you can put each routine in a function in a separate file with the appropriate return value. Otherwise, you could do something like the following to eliminate the else statements, and hopefully the program is not large.

a = 1
if a > 0 : print "a is positive"
if a <= 0: print "a is not positive"

test_a = False
b = 0
if a > 0 and b > 0:    test_a = True
if test_a:    print "condition is True"
if not test_a:     print "condition is False"
woooee 814 Nearly a Posting Maven

matrix[x][y] = corr(file[x], file[y])
TypeError: 'list' object is not callable

corr = ## list
matrix[x][y] = corr(file[x], file[y]) ## function

You are using corr as both a list and a function. You'll have to rename one of them.

woooee 814 Nearly a Posting Maven

A quick example of a spiral using deque. It still has a few problems (works best with a square and prints too many) but shows the general concept.

from collections import deque

##========================================================================
def print_spiral( total_cols, total_rows ) :
   d_list = []  ## hold pointers to separate deque objects
   for j in range( 0, total_rows ) :
      d_list.append( deque( ) )

   ##  find center square
   this_row = total_rows / 2
   d_list[this_row].append( 1 )

   num_ctr = 1   ## the number to print
   incr = 1      ## 1 for first 10, 2 for second 10, etc
   num_cols = 1  ## number of columns to print for this row for this pass
   stop = total_rows
   x_dir = True  ## True  = + direction (right for x, down for y)
   y_dir = True  ## False = - direction (left for x, up for y)

   for j in range( 0, total_rows ) :
      x_dir = not x_dir

      ## for this row, increment the number and add to each column
      ## in this row, either left to right, or right to left
      for k in range( 0, num_cols ) :
         num_ctr += incr
         if incr <= total_rows :
            if x_dir == True :
               d_list[this_row].append( num_ctr )
            else :
               d_list[this_row].appendleft( num_ctr )

      ## increment the number and add one to row, or subtract one
      ## depending on the direction
      y_dir = not y_dir
      for k in range( 0, num_cols ) :
         num_ctr += incr
         if incr <= total_rows  :
            if y_dir == True :
               if this_row …
woooee 814 Nearly a Posting Maven

Start by asking the player(s) for a name and store it in a dictionary that will also keep track of their score. Then, open one graphic window that will simply display the name and score of the player(s). Worry about the multiple windows and clicking on each at a latter time. The design will be both easier and better if you use a class structure for this. Post the code here and ask for help for any glitches.

woooee 814 Nearly a Posting Maven

Thanks for posting back. I've saved the link as someone else will probably ask this again.

woooee 814 Nearly a Posting Maven

I don't have much experience with this, so only have used ps to a file and parse the file when this is necessary. This may require some tweaking.

def ps_test():
    fname = "./example_ps.txt"
    os.system("ps -AFL > " + fname)     ## or subprocess
    data_recs = open(fname, "r").readlines()
    for rec in data_recs:
         if the_program_name in rec :
             print "Found", rec
             return 1     ## program is running
    return 0      ## Not found

Edit: multiprocessing/pyprocessing has a getPID()and isalive() function that you may be able to use. http://www.doughellmann.com/PyMOTW/multiprocessing/basics.html#daemon-processes

woooee 814 Nearly a Posting Maven

It is easier to code than to explain. This will only work if you use a fixed width font. A proportional font would require more work. It is a little bit tricky in that you want to print one sub-list based upon the "b" in the previous sub_list. I have chosen to look for "b" in this sub-list and print the next sub_list. Note that "list" is a reserved word in Python and should not be used as a variable name.

a = 'a'
b = 'b'
c = 'c'
d = 'd'
X = 'X'
lst = [[a, b, c, d],[a, X, X, b, c, d],[a, X, X, b, c, d],[a, b, c, d]]
spaces = ""
print "".join(lst[0])
## only process through the next to the last sub-list
## since we print the next sub-list
for ctr in range(0, len(lst)-1):
   sub_lst = lst[ctr]
   w_ctr = 0
   ##  look at each letter
   while (sub_lst[w_ctr] != b) and (w_ctr < len(sub_lst)):
      spaces += " "
      w_ctr += 1
   ##  prints the second through the last sub-list with spaces
   ##  from this list prepended
   print spaces + "".join(lst[ctr+1])
woooee 814 Nearly a Posting Maven
if "EMERGENCY" or "Help" or "!" in heading:
   pass
elif ("no idea" in body) or (not Code() in body):
   pass
lllllIllIlllI commented: Like the only original poster in the thread :S +2
woooee 814 Nearly a Posting Maven

A dictionary may be a better container than a list of lists. If you give each square a unique number, from 1-81, then the neighbors are simple to find.
square -1 and +1 for this row
square -9 and + 9 for this column
(square -9) -1 and + 1; and (square +9) -1 and +1 for diagonals.

woooee 814 Nearly a Posting Maven

Generally, the structure is more like this.

import time
 
count = 0
PrevTime = time.time()
 
while count < 1000:
    count +=1

print ("It took ", time.time() - PrevTime)
raw_input()

Using "==" in a loop is dicey in more complicated loops, as the counter could be incremented more than once. If you want to do this, use
if count > 999: instead

woooee 814 Nearly a Posting Maven

I think you could check for a number in the second position, if I understand correctly that overlays use numbers and updates/adds use a letter.

if len(line.strip()) and \
   not line.startswith("Found") and \
   not line[1].isdigit():
pizte commented: Clear and concise. Self explainable. +0
woooee 814 Nearly a Posting Maven

So i searched the sys.path for 2.6 and included
usr/lib/python2.6/dist-packages
in python3 sys.path

So you are obviously using PyQT4 built for Python 2.6. The error message confirms it.

undefined symbol: PyString_FromString

Ask how to install PyQT for both 2.6 and 3.x on the Ubuntu or PyQt forum. Some one has done this and if there isn't anything in the repositories then there is probably a deb package that someone has made. Otherwise you will have to build from source against Python 3.x The good news is that if you screw up things, you can just re-install PyQT and get back to where you are now.

woooee 814 Nearly a Posting Maven
base = Rectangle(p1,p2)

Can you draw a rectangle with only 2 points? The simple way to do this is to have the house rectangle on the horizontal (set both x values to the same integer), then you just have to set the x from the door click to the x of the base of the house, and check that the y value is between the two y values of the house.

woooee 814 Nearly a Posting Maven

A Google coughed up pyq, a download for quotes from Yahoo, and there are sure to be others. This question would probably get more answers on a trading forum, as this one is for coding only.

woooee 814 Nearly a Posting Maven

Python does not have static variables, but does have global variables, which those are not. They are class objects and would be called using
Atom.cartesian
both inside and outside the class. In this simple example, note that cartesian belongs to the class and not the instance of the class:

class Atom:

    cartesian = 1

    def __init__(self):
        self.atom_name = "atom name"

    def print_cartesian(self):
        print "cartesian =", Atom.cartesian

print Atom.cartesian  ## --> 1
try:
    print Atom.atom_name  ## AttributeError: class Atom has no attribute 'atom_name'
except:
    print

Atom.cartesian += 1
x = Atom()
print Atom.cartesian
print x.atom_name
x.print_cartesian()
woooee 814 Nearly a Posting Maven

You have both class instances and class objects. The variables
cartesian = dict()
bondList = list()
atomName = str()
atomicNum = int()
would point to the same variable (block of memory) for all instances of the class, where
self.atomName = name
self.atomicNum = atNum
are unique for each instance of the class (point to a separate block of memory for a separate class instance). I think you want the latter so your code would change for "bondList" and the other variables.

class Atom:
    def __init__(self,name, atNum):
        self.atomName = name
        self.atomicNum = atNum
        self.bondList = []

    def addBondedAtom(Atom):
        self.bondList.append(Atom)

You might also take a look at the style guide for variable name conventions http://www.python.org/dev/peps/pep-0008/

jorgejch commented: Clear, didactic and solved the issue. +0
woooee 814 Nearly a Posting Maven

It's Christmas madness already. In 1999, the United States Postal Service issued a Slinky postage stamp (the spring toy that slinks down the stairs). In 2001, House Bill No.1893 of the 2001 Session of the General Assembly of Pennsylvania made Slinky the Official State Toy of Pennsylvania. Carried by communications soldiers in Vietnam, Slinky was tossed over a high tree branch as a makeshift radio antenna. Slinky was incorporated into a spring device used to pick pecans from trees. Over 300 million Slinkys have been sold.

woooee 814 Nearly a Posting Maven

That's called string formatting http://www.python.org/doc/2.5.2/lib/typesseq-strings.html (assuming you are using Python 2.5). A simple example:

year = 1
pop = 12345
for x in range(2):
    print "Year %d population = %d" % (year, pop)
    year += 1
    pop += 12345
woooee 814 Nearly a Posting Maven

For starters, you can use one function to do the output. Also, store the output strings in a dictionary. You can then use a for loop to go through the
if intFCITC_list[0-->10]<0:
and send the appropriate string and starting time to the function to print. I only did the first two to give you an idea, and also assumed that 7 lines are written in every case. If you want to change the dates, you can supply a month, day, and year to a function to place it in the string prototypes. This code should run as is, although it prints instead of writing to a file for testing. Add some print statements if you don't understand what some variables contain.

'''A dictionary of lists.
The first list is for less than zero, the second list for not less than zero
The first string in each sub-list is the string to print
The second number is starting time (be sure to test for > 12:00)
'''
output_dict = {}
output_dict[0] = (['OUCT,0,,,,,,OUC,FPL,11/18/2009 %d:00,11/18/2009 %d:00', 0], \
                  ['OUCT,+OUC2FPL+,,,,,,,OUC,FPL,11/18/2009 %d:00,11/18/2009 %d:00', 0])
output_dict[1] = (['OUCT,0,,,,,,OUC,FPC,11/18/2009 %d:00,11/18/2009 %d:00', 0], \
                  ['OUCT,+OUC2FPC+,,,,,,,OUC,FPC,11/18/2009 %d:00,11/18/2009 %d:00', 0])

## dummy list for testing
intFCITC_list = []
intFCITC_list.append(-1)
intFCITC_list.append(1)

def print_this( format_list ):
    format_str = format_list[0]
    start_num = format_list[1]
    for y in range(7):
        print format_str % (start_num, start_num+1)
        start_num += 1
        if start_num > 12:
            start_num -= 12

for x in range(0, 2):
    output_list = output_dict[x]
    if intFCITC_list[x] < 0:
        less_than_list = output_list[0]
        print_this(less_than_list)
    else: …
woooee 814 Nearly a Posting Maven

Why does it fill every spot instead of only one?

Because every row is the same block of memory = fieldb

for i in range(columns):
    fieldb.append('.')
for i in range(rows):
    fielda.append(fieldb)
#
# These will all be the same because they all point to the same memory location
for row in fielda:
    print id(row)
#
# You want to use (I think, you'll have to print the id() to be sure)
fielda = []
for x in range(rows):
    fieldb = []  ## should be a new block of memory each time
    for y in range(columns):
        fieldb.append(".")
    fielda.append(fieldb)

And you should not use "i", "l", or "o" as single digit variable names because they can look like numbers
x = 1
x = l
x = I

woooee 814 Nearly a Posting Maven

You really should consider using a class for this. Otherwise it gets real convoluted real fast. If you want some assistance, post back.

woooee 814 Nearly a Posting Maven

You should use this with a try/except (within is while) since anyone would enter more or fewer characters at some time.

woooee 814 Nearly a Posting Maven

I would assign a unique number to each character that makes up a maze. Then you can find S(tart) and proceed in whatever direction there is an space, keeping track of the path taken so you try different solutions. Also, you might want a variable that is set to True if there are two or more options within the path, so you can repeat with the other option.

woooee 814 Nearly a Posting Maven

Agreed. You should do your own research from here. Especially since you are just going to forget most of this anyway. Herb Schildt was the consensus guru when this was commonly done, so if you can find a copy of "The Craft of C" online or in a library, it will explain what it takes to write the program. Bottom line is that somewhere, for every OS, you have to have something that puts pixels on the screen via a program, for every video card, monitor, etc. The precise details are left up to you.

woooee 814 Nearly a Posting Maven

If you wanted to draw a box on the screen and display some sort of message, you would have to access the memory on the video card. Before toolkits like Tkinter that is the way it was done. In simple terms, you would copy that part of the screen, blank it by putting whatever color you wanted to use, draw the outline of the box with another color, add any other color effects you wanted to use, and then display the message. When finished, you would copy back the original contents of the window. Every one who did programming had these routines in their toolbox, although C, not Python was the language of choice. Today, I don't think Python has the capability as that requires a little assembly code, so the programming language has to be able to execute some assembly.

woooee 814 Nearly a Posting Maven

Use the min function to find the smallest number. Is it just me, or is there one person with 100 different ID's who posts every homework problem here, saying they don't have a clue==don't even try. If you are lost then there is very little we can do to help you. "I'm lost" doesn't mean anything without some code to show what that means.

test_file = [ "Alabama 3200",
              "Denver 4500", 
              "Chicago 3200",
              "Atlanta 2000" ]

print min([int(rec.split()[1]) for rec in test_file])

If you can not use min, but have to find it yourself, Google for "python find smallest number" and look at the second entry found, "Roles of Variables (v2, Python)".

woooee 814 Nearly a Posting Maven

88282440 PKD0

Test that the first byte is a digit, split on the space if true, and test that the second element starts with a "P", then print everything that starts with a "D" that follows if I follow your description (which was not very clear). You can also store all records from one checkpoint. When the next checkpoint is found, process the list of the previous records and start storing again.

woooee 814 Nearly a Posting Maven

Try this and then go to the page from the earlier link which explains why you returned a tuple.

def junk(f):
    d1 = {}
    d2 = {}
    for line in f:
        columns = line.split(":")
        letters = columns[1]
        numbers = columns[2]
        d1[letters] = numbers
        d2[numbers] = letters
    return d1, d2

if __name__ == "__main__":
    f = open("filename.txt")
    d1_ret, d2_ret = junk(f)[0]
    print type(d1_ret)
woooee 814 Nearly a Posting Maven

You would probably have to use a large grid with squares, like a large tic-tac-toe board, with a unique number for each square . Also, if you store what the square is, a wall or open space, then you should be able to come up with a formula/decision table to calculate the squares surrounding any given square and so can tell which way the player can and can not move.

woooee 814 Nearly a Posting Maven

First you are not returning a dictionary. I've added a print statement to show that. Also, take a look at "returns" and "arguments" here http://www.penzilla.net/tutorials/python/functions/ for the "something" function.

def junk(f):
    d1 = {}
    d2 = {}
    for line in f:
        columns = line.split(":")
        letters = columns[1]
        numbers = columns[2]
        d1[letters] = numbers
        d2[numbers] = letters
    return (d1, d2)
 
 
def something():  
    print d1
    print d2
 
if __name__ == "__main__":
    f = open("filename.txt")
    d1 = junk(f)[0]
    print "type d1 =", type(d1)
    d2 = junk(f)[1]
woooee 814 Nearly a Posting Maven

It is generally done with a list.

def test_input(input_str):
   accept_list = []
   for x in range(0, 10):
      accept_list.append(str(x))
   accept_list.append("d")
   accept_list.append("r")

   for character in input_str:
      if character not in accept_list:
         return False

   return True
#
#  test it
input_string = "a"
print input_string, test_input(input_string)
input_string = "3A3"
print input_string,  test_input(input_string)
input_string = "9d3"
print input_string,  test_input(input_string)
woooee 814 Nearly a Posting Maven

That is usually a directory problem, i.e. it can't find something because it is not in the current directory. For this line, give it the absolute path name
tune = mp.newMedia("/complete/path/Therock.wav")
If that doesn't work, check that something is printed so you know the program was started. Finally, if you haven't found anything, use a try/except to catch error messages and see if anything is printed.

woooee 814 Nearly a Posting Maven

It should be simple with Python's gstreamer interface. http://pygstdocs.berlios.de/

woooee 814 Nearly a Posting Maven

The get an error when i try to execute this?

Not enough info for anyone to help (could be an indentation error, or could be in the calcs). First add some print statements for the individual calcs to isolate the error, and post the specific error message.

def distance_between_points(p1, p2):
   p2subp1 = p2-p1
   p1subp2 = p1-p2
   print "after subtraction", p2subp1, p1subp2
   ## one print for each step

point_1 = (1, 2)
point_2 = (4, 6)
distance_between_points(point_1, point_2)
woooee 814 Nearly a Posting Maven

Do you have to use something like queue_draw() to update the widget? The pygtk.org site has been down for 2 days now, so can't look it up, but try it and see.

Do You mean I have to give whole my code and/or a screenshot of my wxglade window?

Just write a simple program using whatever type of widget it is, label, entry box, etc., and update the text in some way. There may be a problem with the way you are coding it, but it may also be that the list "name" is empty. In whatever case, a simple program to illustrate will work fine.

And if you did not get the color change or set widow size answers. Check line 30 and 61 in this code found somewhere on the web at some time in the past.

import pygtk
pygtk.require('2.0')
import gtk

class HelloWorld2:

    # Our new improved callback.  The data passed to this method
    # is printed to stdout.
    def callback(self, widget, data):
        print "Hello again - %s was pressed" % data

    # another callback
    def delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False

    def __init__(self):
        # Create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        # This is a new call, which just sets the title of our
        # new window to "Hello Buttons!"
        self.window.set_title("Hello Buttons!")
        width = 200
        height = 100
        self.window.set_size_request(width, height)

        # Here we just set a handler for delete_event that immediately
        # exits GTK.
        self.window.connect("delete_event", self.delete_event)

        # Sets the border …
woooee 814 Nearly a Posting Maven
finderGuess = finderGuess - ((((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-
          (monthlyPayment/loanAmount))/(((((1+finderGuess)^numberMonths)-1)
          (finderguess*(numberMonths*((1+finderGuess)^(numberMonths-1)))+
          (1+finderGuess)^((finderGuess*(1+finderGuess)^numberMonths)*
          (numberMonths*((1+finderGuess)^(numberMonths-1)))))/
((((1+finderGuess)^numberMonths)-1)^2))))

I hope you are the only one who has to deal with this code. It may help to remember that the compiler can only do one thing at a time, unless you have a multi-core machine and an OS that is multi-core aware, which is very unlikely. So, for most of us there is little between one long calculation and several shorter ones, from the compiler's viewpoint. But there is a big difference in terms of readability.

Note the lack of a mathematical symbol between two lines of code as pointed out below. Also, all of your calculations are done as integers. You may or may not want floats instead.

## a calculation common to several other calcs
## increase the guess by one and raise it to the power of the number of months
interim divisor = (1+finderGuess)^numberMonths

## this is the do-hickey which is calculated by
## subtractng one from the thing-ma-bob and raising it to
## the power of 2
last_divisor = interim_divisor - 1
last_divisor = last_divisor^2

"""  note that there is no mathematical symbol between the first and
     second lines in this block of code
(((((1+finderGuess)^numberMonths)-1)
(finderguess*(numberMonths*((1+finderGuess)^(numberMonths-1)))+
(1+finderGuess)^((finderGuess*(1+finderGuess)^numberMonths)*
(numberMonths*((1+finderGuess)^(numberMonths-1)))))
"""

## so the code becomes something like this, making sure that the number are floats, or are converted in the calculations.
finderGuess = finderGuess - descriptive_name_for_numerator /
              descriptive_name_for_first_divisor /
              descriptive_name_for_second_divisor /
              descriptive_name_for_third_divisor /
              last_divisor
woooee 814 Nearly a Posting Maven

There are several online pages to do that.
http://primes.utm.edu/curios/includes/primetest.php
is one found on this very good page
http://primes.utm.edu/

Your program works correctly, at least for the range you tested.

woooee 814 Nearly a Posting Maven

Also, is there anyway in Python that you can test whether or not a line of data is binary?

All data is binary. That's the way the computer does it. I am assuming that you mean bytes that are not text. If you look at an ASCII table like this one http://www.asciitable.com/ it becomes apparent that for the English character set you want to check for anything less than decimal 32 (space) or greater than decimal 126 (~). Python uses ord(character) to covert and I don't know of any way other than converting and checking every byte in the file. Post some code and we can help you with problems

BTW, thread titles like ...
Can Python do this?
I need help
Help
are meaningless and kind of stupid! Use a tiltle that tells the rest of us what you want.

It takes a large amount of self control not to respond with
Can Python do this? (Who are you, Steve Urkel)
I need help (We all do but most of us can't afford a psychiatrist)
Help (Have you fallen and can't get up?)

woooee 814 Nearly a Posting Maven

Wouldn't this lead to an infinite loop.

def Prime(x,y):
    n=2
    if x == 1:
       Prime(x+1,y)
   elif x == 2:
      print (2)
      Prime(x+1,y)
   elif x <= 0:
      print ("Number must be a positive integer"
   else:
      while n < n+1:     ## <=====
woooee 814 Nearly a Posting Maven

Via CNet

On average, cell phone users in the United States buy new gear every 18 months. In Japan, it's about 9 months. In Europe, cell phone users get new phones every year.

woooee 814 Nearly a Posting Maven

i am a beginner. i have no idea how i can make Tic Tac Toe game.
please help me.

Take on something that is easier first. If you have no idea at all on how to start, then there is little that anyone can do.

woooee 814 Nearly a Posting Maven

Start with something like this (Not Tested).

energyFile = open("EnergySources.csv","r")
state_dict = {}
for line in energyFile:
    line = line.strip()
    fields = line.split(",")
    state = fields[0].strip()
    if state == "State":
        ##   you didn't give us any idea where state name comes from
        state_name = fields[???]
        state_dict[state_name] = fields[1:]
    elif not len(state):
        print "this rec has no state", line
    else:
        print 'not a "State" record', line

answer = ""
while answer not in state_dict:
    answer= raw_input("Pick a state")
    if answer in state_dict:
        data_list=state_dict[answer]
        print answer, data_list
        print "     total is %9.2f" % float(data_list[-1])
    else:
        print "Not valid"

And for future reference, you will not find many people who will go through a problem with 45 lines to read. State one or two specific problems and you will get better responses.

woooee 814 Nearly a Posting Maven

Since you are using python 2.x, this won't work. Test this code by entering "R1" and "1/01/2000" and see what happens ( and look at "Is there an easy way to do user input in python?" here http://www.faqts.com/knowledge_base/index.phtml/fid/245 ).

def results ():
    roomnumber = input ("Enter Room Number: ")
    date = input (" Enter the Date: ")
    print roomnumber + date
woooee 814 Nearly a Posting Maven

Double post, sorry.

woooee 814 Nearly a Posting Maven

Some corrections to get you started, provided the indentation is correct.

def encrypted_message():
    ##  "message" has not been defined in this function
    char = message
    encrypted_message = ""

    ## encrypted_message = "" from the previous statement
    for char in encrypted_message:
        x = ord(char)
        if char.isalpha():

            ## "key" has not been declared yet
            x = x + key
            offset = 65
            if char.islower():
                offset = 97

        ##   if char is not alpha, then offset has not been defined
        while x < offset:
            x += 26
        while x > offset+25:
            x -= 26

        ##  key is being added to x twice, once in statement #11 and once here
        encrypted_message += chr(x+key)
    print encrypted_message
woooee 814 Nearly a Posting Maven

You want to use "readlines()",as readline reads one line at a time, where readlines() reads all data. Also, a print statement is added for clarity.

records = open(grades.txt,'r').readlines()
table = []
newtable = []
for line in records:  
   line = line[:-1]
   r = string.split(line,':')
##   table.append(r)
##  for x in table:           ## x = r so just use r
##   for all in x:
   for all in r:
    print "testing isalpha()", all.isalpha(), all
    if all.isalpha() == 0:
     num = float(all)
    else:
     num = all

##---  get the first part of the program working first
##   t.append(num)
##   newtable.append(tuple(t))
woooee 814 Nearly a Posting Maven

And it's not tough to do.

import Tkinter

root = Tkinter.Tk()
root.title('Canvas')
canvas = Tkinter.Canvas(root, width=450, height=450)

canvas.create_oval(100,50,150,100, fill='gray90')

x = 125
y = 175
stick = canvas.create_line(x, y-75, x, y)

diff_x = 25
stick_leg1 = canvas.create_line(x, y, x-diff_x, y+50)
stick_leg2 = canvas.create_line(x, y, x+diff_x, y+50)

y=145
stick_arm1 = canvas.create_line(x, y, x-30, y-20)
stick_leg2 = canvas.create_line(x, y, x+30, y-10)

canvas.pack()
root.mainloop()

But for some reasn (reason) my code doesnt (doesn't) seem to be working

What version of Python are you using? Make sure you are using an integer for the radius.

def draw_circle():
    x = input("please enter the radius of the circle: ")
    print "the radius is", x, type(x)
    centre= Point(100, 100)
    circle1 = Circle(centre, x)
    circle1.draw(win)
woooee 814 Nearly a Posting Maven

This week's lab is to design a hangman game. Your program should be able to open a text file which contains a list of words (one word on each line of the text file) and read the words into a list to contain all of the possible words.

If you don't know how to open and read a text file, then look at one of the online tutorials like here http://effbot.org/zone/readline-performance.htm Then get the input from the user, etc. Finally, post the code here that you are not able to complete.

It seems like so many people come on to the forums requesting for home works assignments they have no idea on how to do

This seems to be this year's excuse to get someone else to do it for you. Last year it was "I Googled for hours and can't find the answer". Next year it will be something else.

woooee 814 Nearly a Posting Maven

This is very simple to do.

print len(set([1,2,4,2,7]))
woooee 814 Nearly a Posting Maven

Google came up with this site which has a link to download source code. I hope you didn't pay $99.95 for the book! http://www.jbpub.com/catalog/9780763746025/