Re: [Tutor] Passing perimeters in dictionary values?

2009-02-24 Thread nathan virgil
Erm, it's still not working... Whenever I try to use the talk method (which reports the mood, and doesn't take parameters), it says I gave it too many parameters. Maybe it might help if I posted the code in it's entirety # Critter Caretaker # A virtual pet to care for class Critter(object):

Re: [Tutor] Passing perimeters in dictionary values?

2009-02-24 Thread nathan virgil
On Tue, Feb 24, 2009 at 6:50 PM, Alan Gauld wrote: > > > Or you can build the param value into the dictionary: > > selection = raw_input("Choice: ") > choices = { > "0":(quit, None), > "1":(crit.talk, "Hi there"), > "2":(crit.eat, "Nuts"), > "3": (crit.play, "Soccer") > "4": (crit.play, "Baseball"

Re: [Tutor] Passing perimeters in dictionary values?

2009-02-24 Thread nathan virgil
m going to go with, anyway. At least until I can learn about lambdas, or even some other solution. On Tue, Feb 24, 2009 at 2:42 PM, Kent Johnson wrote: > On Tue, Feb 24, 2009 at 2:03 PM, nathan virgil > wrote: > > I'm experimenting with OOP using the Critter Caretaker scri

[Tutor] Passing perimeters in dictionary values?

2009-02-24 Thread nathan virgil
I'm experimenting with OOP using the Critter Caretaker script from Python Programming for the Absolute Beginner as my basis. I've noticed that a dictionary/function combo is a great way to handle menus, and so I've adapted the menu to read as: selection = raw_input("Choice: ") choices = {"0":quit

Re: [Tutor] Creating sub-menus?

2008-12-31 Thread nathan virgil
Okay, so I changed line 84 from: current_menu to: choice = current_menu, and the menu prtion seems to work fine. Only problem now is, once I select a formula, it repeats that function over and over again, never going back to a menu. Should I just add something like: choice = current_menu to ea

[Tutor] Creating sub-menus?

2008-12-30 Thread nathan virgil
I was reading the Non-Programmer's Tutorial for Python, and became really proud of myself when I realized I could create a menu for functions. I decided to try to take this one step further and see if I could create not just a menu, but a menu with sub-menus, too! Ultimately, the idea I came up wit

Re: [Tutor] Hands-on beginner's project?

2008-10-03 Thread nathan virgil
On Fri, Oct 3, 2008 at 10:24 AM, nathan virgil <[EMAIL PROTECTED]>wrote: > > > On Fri, Oct 3, 2008 at 10:02 AM, Luke Paireepinart <[EMAIL PROTECTED] > > wrote: > >> On Fri, Oct 3, 2008 at 8:50 AM, nathan virgil <[EMAIL PROTECTED]> >> wrote: >>

Re: [Tutor] Hands-on beginner's project?

2008-10-03 Thread nathan virgil
On Fri, Oct 3, 2008 at 10:02 AM, Luke Paireepinart <[EMAIL PROTECTED]>wrote: > On Fri, Oct 3, 2008 at 8:50 AM, nathan virgil <[EMAIL PROTECTED]> > wrote: > > > > > > On Fri, Oct 3, 2008 at 9:19 AM, David <[EMAIL PROTECTED]> wrote: > >> > &

Re: [Tutor] Hands-on beginner's project?

2008-10-03 Thread nathan virgil
On Fri, Oct 3, 2008 at 9:19 AM, David <[EMAIL PROTECTED]> wrote: > > Okay, I'm resurrecting this project. > Where is this project code? > Right here. The content is going to eventually go through some drastic changes, but what's here should be good enough for testing.

Re: [Tutor] Finding the "streaks" in heads/tails list

2008-10-03 Thread nathan virgil
You need to store the count before resetting it since you want > to know the largest value of count over the list. Or at least keep a > separate max variable that you update if count > max. > Fairly easy: if Cur_Count > Max_Count: Max_Count = Cur_Count See? Just two extra lines of code. _

Re: [Tutor] Hands-on beginner's project?

2008-10-03 Thread nathan virgil
t; variable name > doesn't exist in the current namespace, so it can't be compared to start. > It looks like you wanted room = start. > > On 10/2/08, nathan virgil <[EMAIL PROTECTED]> wrote: > >> Okay, I'm resurrecting this project. I did a little more wo

Re: [Tutor] Hands-on beginner's project?

2008-10-02 Thread nathan virgil
Okay, I'm resurrecting this project. I did a little more work on it then what you see here, but that ended up getting accidentally deleted, and I haven't done anything with Python since. I'm running into one problem already, and I haven't really added any extra code. In the content (at this point,

[Tutor] Hands-on beginner's project?

2008-06-24 Thread nathan virgil
I'm very new to Python, and (to a slightly lesser extent) programming in general. I'd like to get some experience by practicing simple-yet-functional programs, with a bit of an emphasis on games. The first game I'd like to attempt would be a simple, non-linear story, similar to those choose-your-ad