[Tutor] Re.findall question

2012-06-26 Thread Alexander Quest
I'm a bit confused about extracting data using re.search or re.findall. Say I have the following code: tuples = re.findall(r'blahblah(\d+)yattayattayatta(\w+)moreblahblahblah(\w+)over', text) So I'm looking for that string in 'text', and I intend to extract the parts which have parentheses

Re: [Tutor] Notepad++ question

2012-06-14 Thread Alexander Quest
/2012 02:36 PM, Alexander Quest wrote: Ok, thanks guys. I also had one more quick question regarding a piece of boilerplate code: To get a response, you will needs to leave your question at the python tutor newsgroup. We are part of a group, not offering private advice. Normally, you just

Re: [Tutor] Notepad++ question

2012-06-14 Thread Alexander Quest
, there is no variable called _name_, and even if there was, why is it comparing it to _main_? Why can't the main function just be called by typing main()- why do we need this if statement to precede it? Thanks. -Alex On Thu, Jun 14, 2012 at 3:17 PM, Alexander Quest alexxqu...@gmail.comwrote: Got it Dave- sorry

Re: [Tutor] Notepad++ question

2012-06-14 Thread Alexander Quest
Thanks Walter; I believe I understand the reasoning behind it, though not all of the mechanics, but for now, your answer is more than sufficient. -Alex On Thu, Jun 14, 2012 at 4:10 PM, Walter Prins wpr...@gmail.com wrote: Hi Alex, On 14 June 2012 23:18, Alexander Quest alexxqu...@gmail.com

[Tutor] Notepad++ question

2012-06-06 Thread Alexander Quest
Hey all; my question is regarding editing Python code in Notepad++. When I run this piece of code in Notepad++: def fix_start(s): var1 = s[0] var2 = * var3 = s.replace(var1, var2) return var3 I get an indentation error, which reads: File

Re: [Tutor] Indexing a list with nested tuples

2011-08-05 Thread Alexander Quest
My bad- meant to say [1]. Thanks. -Alexander On Fri, Aug 5, 2011 at 12:36 PM, Christopher King g.nius...@gmail.comwrote: On Tue, Aug 2, 2011 at 10:44 PM, Alexander Quest alexxqu...@gmail.comwrote: have [0] to indicate that I want to go to the second value within that first item, which

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Alexander Quest
: Alexander Quest wrote: Hi guys- I'm having a problem with a list that has nested tuples: attributes = [(strength, 0), (health , 0), (wisdom , 0), (dexterity, 0)] I've defined the list above with 4 items, each starting with a value of 0. The player enters how many points he

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Alexander Quest
= [(strength, 0), (health , 0), (wisdom , 0), (dexterity, 0)] Sorry if this is a bit confusing. Thanks for your help and tips so far Bob. -Alex On Wed, Aug 3, 2011 at 5:52 AM, bob gailer bgai...@gmail.com wrote: On 8/2/2011 11:39 PM, Alexander Quest wrote: Hey Bob- thanks for the reply. Here

[Tutor] Indexing a list with nested tuples

2011-08-02 Thread Alexander Quest
Hi guys- I'm having a problem with a list that has nested tuples: attributes = [(strength, 0), (health , 0), (wisdom , 0), (dexterity, 0)] I've defined the list above with 4 items, each starting with a value of 0. The player enters how many points he or she wants to add to a given item. The

Re: [Tutor] Running files from command prompt

2011-07-29 Thread Alexander Quest
works out with Python 3.1, and if not, I'll switch over to a different one. -Alexander On Thu, Jul 28, 2011 at 10:27 PM, Steven D'Aprano st...@pearwood.infowrote: Alexander Quest wrote: To clarify, the particular file that was giving me trouble was the basic hello world file. The original

[Tutor] Running files from command prompt

2011-07-28 Thread Alexander Quest
I downloaded the google's python exercise files from their website ( http://code.google.com/edu/languages/google-python-class/set-up.html), unzipped them, and placed them in C. I then added the following to the PATH variable under system settings so that I could type python in command prompt and

Re: [Tutor] Running files from command prompt

2011-07-28 Thread Alexander Quest
. -Alex On Thu, Jul 28, 2011 at 7:11 PM, Dave Angel d...@davea.name wrote: On 07/28/2011 09:58 PM, Alexander Quest wrote: I downloaded the google's python exercise files from their website ( http://code.google.com/edu/**languages/google-python-class/**set-up.htmlhttp://code.google.com/edu

Re: [Tutor] Running files from command prompt

2011-07-28 Thread Alexander Quest
, Jul 28, 2011 at 7:58 PM, Alexander Quest alexxqu...@gmail.comwrote: Awesome- thanks for that Dave! The programs all work now, except that the google exercise programs are all from Python 2.X and I'm running 3.1, so some of them are giving me errors. Is there a way around this or do I have

[Tutor] Assigning range

2011-07-27 Thread Alexander Quest
Does anyone know how to assign a certain numerical range to a variable, and then choose the number that is the middle of that range? For example, I want to assign the variable X a range between 1 and 50, and then I want to have the middle of that range (25) return with some command when I call it

Re: [Tutor] Assigning range

2011-07-27 Thread Alexander Quest
Thanks Steven- I'll try that out. -Alex On Wed, Jul 27, 2011 at 5:40 PM, Steven D'Aprano st...@pearwood.infowrote: Alexander Quest wrote: Does anyone know how to assign a certain numerical range to a variable, and then choose the number that is the middle of that range? For example, I

Re: [Tutor] Assigning range

2011-07-27 Thread Alexander Quest
will work if you just need the mid point of two numbers; either ints or floats. mid_x = middle_number(0, 1000) # mid_x = 500 DW On Jul 27, 2011, at 8:16 PM, Alexander Quest wrote: Does anyone know how to assign a certain numerical range to a variable, and then choose the number

[Tutor] Basic program question

2011-07-24 Thread Alexander Quest
Hello- I am running Python v 3.1.1. As an exercise, I wrote a simple coin flipper program, where the computer flips a coin 100 times and then prints out the number of heads and tails. My program crashes immediately if I run it normally through the command line, but if I go to Run- Run Module, it

[Tutor] Basic question on spaces

2011-07-19 Thread Alexander Quest
Hello; I'm a new student of Python using Python Programming for Absolute Beginners 3rd edition by Michael Dawson as my guide. This is a basic question regarding spaces. I'm not sure how to make it so spaces do not show up between variables and basic strings, particularly before commas and after