[Tutor] Tic-Tac-Toe

2011-02-19 Thread Ben Ganzfried
side the appropriate cells, but clearly the error means that what I'm trying to do is not what is actually happening. My full code is below and I would greatly appreciate any help you can provide. Thanks, Ben _- #Ben Ganzfried #2/18/11 #Tic-Tac-Toe class Player: def

[Tutor] Roulette Unit Test Questions

2011-02-05 Thread Ben Ganzfried
Hey, I'm having a lot of confusion getting the unit test working for one of my classes for the Roulette bot I'm working on and would greatly appreciate any advice or help. Here is the description of what I am trying to do: http://homepage.mac.com/s_lott/books/oodesign/build-python/html/roulette/b

[Tutor] Project Idea

2011-01-28 Thread Ben Ganzfried
Hey guys, Would it be feasible for a beginner to write a script that could connect with: https://chrome.google.com/extensions/detail/laankejkbhbdhmipfmgcngdelahlfoji ? More specifically, I am interested in writing a script such that the user would have to enter a short password (say 6 random lett

[Tutor] OOP question

2011-01-18 Thread Ben Ganzfried
Hey guys, I'm trying to get a version of Roulette working and I had a quick question. Here is my code: class Outcome: def __init__(self, name, odds): self.name = name self.odds = odds def winAmount(self, amount): return odds*amount def __eq__(self, other):

Re: [Tutor] Object/Class Beginner Questions

2011-01-14 Thread Ben Ganzfried
* I meant that*: A method actually can be called from the command prompt, but the syntax is quite different than that used to call a function from the command prompt. On Fri, Jan 14, 2011 at 2:37 PM, Ben Ganzfried wrote: > I actually just figured it out (since the tutorial talks about

Re: [Tutor] Object/Class Beginner Questions

2011-01-14 Thread Ben Ganzfried
be called from the command prompt. Although if this isn't quite right or there's more to it, I would still definitely appreciate any advice you have. Thanks again, Ben On Fri, Jan 14, 2011 at 1:53 PM, Ben Ganzfried wrote: > Hey guys, > > I'm using a tutorial geared for

[Tutor] Object/Class Beginner Questions

2011-01-14 Thread Ben Ganzfried
Hey guys, I'm using a tutorial geared for a 2.x version of Python and I am currently using Python 3.1-- so it is possible that my confusion has to do with different notations between them. But in any case, here is what I have: >>> type(Time) >>> t1 = Time() >>> type(t1) where: class Time:

[Tutor] Odd result from function call

2011-01-07 Thread Ben Ganzfried
When I call one of my functions from the shell (ie compare(10, 5)) it produces the correct output. However, when I run the program after calling the method later in the script, the result is bizarre. I'm curious why the wrong result is printed. Here is an example: def compare(x,y): if x < y

[Tutor] Java Virtual Machine Launcher Question

2010-12-26 Thread Ben Ganzfried
Happy holidays everyone! My current question relates to a broader python programming question I have and so I thought it was worth posting here. I'm trying to read a single MAGE-TAB file (http://www.mged.org/mage-tab/) and acquire metadata. I just downloaded WinRAR to open zip files, but when tr

[Tutor] AttributeError: 'list' object has no attribute 'find'

2010-12-21 Thread Ben Ganzfried
Hey, I keep getting the error above and unfortunately browsing through google and finding similar responses has not been fruitful for me. My code is below and I have marked off the location of the problem in my code. I'm wondering the following: 1) Doesn't the read() file object method return t

[Tutor] Tab delimited question

2010-12-13 Thread Ben Ganzfried
I'm searching line by line for certain tags and then printing the tag followed by the word immediately following the tag. So for example, suppose I had the following line of text in a file: "this is a key test123 noisenoise noise noise noise" In this example, I would wan

[Tutor] Meaning of -1 in Python

2010-12-10 Thread Ben Ganzfried
I'm currently working through the Google Python tutorial exercises and had questions about the following function: def not_bad(s): # +++your code here+++ # LAB(begin solution) n = s.find('not') b = s.find('bad') if n != -1 and b != -1 and b > n: s = s[:n] + 'good' + s[b+3:] return

[Tutor] Scanning a file for specific text and copying it to a new file

2010-12-02 Thread Ben Ganzfried
I'm trying to build a program that reads in a file and copies specific sections to a new file. More specifically, every time the words "summary on" are in the original file, I want to copy the following text to the new file until I get to the words "summary off". My questions are the following: 1