Re: [Tutor] return, why do I need it?

2011-12-11 Thread Robert Sjöblom
On 12/12/2011 01:38 AM, Pete O'Connell wrote: Hi I have been writing python code for a while now and I never return anything within any of my functions, I just (eg.) print stuff or make directories or update a log or what have you. When I look at other people's code they are always returning

Re: [Tutor] Object designer applications - are there any?

2011-08-05 Thread Robert Sjöblom
It struck me that if I write a read in Sybase DDL and spit out Oracle DDL routine and so forth, I'd get a lot of reuse out of it. However, I've not done much OOP at all and consequently, my object design skills are somewhat non-existent. Whilst I have a rough idea of what my properties my

[Tutor] Help with understanding classes

2011-05-21 Thread Robert Sjöblom
I'm trying to wrap my head around classes and their attributes, but am having a hard time doing so. The websites and books that I have consulted haven't been much help; most of them assume prior programming/oop experience, something I lack. From what I understand it's a blueprint, so each

Re: [Tutor] folder and file list (Jorge Romero)

2011-05-10 Thread Robert Sjöblom
Can't you use os bulit-in module? Perhaps you can find this useful http://docs.python.org/library/os.html#os.listdir. That way you don't deal with OS peculiarities such as the one Brett Ritter pointed. On Tue, May 10, 2011 at 8:45 AM, Brett

Re: [Tutor] Python vs. MATLAB

2010-12-07 Thread Robert Sjöblom
Joel Schwartz wrote: Chris, Can you say more about number (7) in your list? What does pass by value mean and what are the alternatives? Oh boy, is that a can of worms... and this is going to be a long post. You might want to go make yourself a coffee first :) [snipped wall of text] That

Re: [Tutor] role playing game - help needed

2010-12-07 Thread Robert Sjöblom
Thanks for the advice. I think I have the dictionary function set up right now although I'm still not clear why it is better than the list. attributes = {strength: 0, health: 0, wisdom: 0, dexterity: 0} Consider where you want to update the points for health Using two lists you need to

Re: [Tutor] role playing game - help needed

2010-12-07 Thread Robert Sjöblom
attributes[strength] = input(\nHow many points do you want to assign to strength?: ) Please let me know if this isn't advisable.  It seems to work on the surface. Close, but remember that input() returns a string. You need numbers so you need to convert strings to integers. Actually,

Re: [Tutor] role playing game - help needed

2010-12-06 Thread Robert Sjöblom
I am starting with a book called Python Programming for the Absolute Beginner by Michael Dawson.  The book has been pretty good and up to this point, I have grasped all the concepts it has covered.  At the end of each chapter, there are a number of challenges you need to complete before moving

Re: [Tutor] REport Card Question

2010-11-29 Thread Robert Sjöblom
 Write a code that will take an input from a user (numerical grade) and convert their numerical grade into a letter grade that is accompanied by a ?smart? statement.  def grade_score(grade):     if grade =95 and grade = 100:         print 'A+, Excellent'     elif grade =85 and grade

Re: [Tutor] Help regarding lists, dictionaries and tuples (bob gailer)

2010-11-23 Thread Robert Sjöblom
On Mon, Nov 22, 2010 at 10:27 AM, tutor-requ...@python.org wrote: Send Tutor mailing list submissions to        tu...@python.org [snip] Ok, I'm clearly thinking in circles here. I used the interpreter to figure out that both are fine but the first example has integers, whereas the second

[Tutor] Help regarding lists, dictionaries and tuples

2010-11-21 Thread Robert Sjöblom
Hi. I'm new at programming and, as some others on this list, am going through Python Programming for the Absolute Beginner. In the current chapter (dealing with lists and dictionaries), one of the challenges is to: Write a Character Creator program for a role-playing game. The player should be

Re: [Tutor] Help regarding lists, dictionaries and tuples

2010-11-21 Thread Robert Sjöblom
[Snip] I don't want a direct answer on how to proceed, but a question that arose during my thinking of the problem was whether dictionaries can have integral data in them, like so: attributes = {Strength : 28, Health : 12} or if they have to be: attributes = {Strength : 28, Health : 12}