[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 around

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 wrote: > Hi Alex, > > On 14 June 2012 23:18, Alexander Quest wrote: > &

Re: [Tutor] Notepad++ question

2012-06-14 Thread Alexander Quest
seen this so far, 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,

Re: [Tutor] Notepad++ question

2012-06-14 Thread Alexander Quest
2 at 6:16 PM, Dave Angel wrote: > On 06/07/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 > tut

[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 "C:\google-python-exercises\google-python

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 wrote: > > > On Tue, Aug 2, 2011 at 10:44 PM, Alexander Quest wrote: >> >> have [0] to indicate that I want to go to the second value within that >> first item,

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Alexander Quest
re it is again for reference: attributes = [("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 wrote: > On 8/2

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Alexander Quest
en <__pete...@web.de> wrote: > 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)

[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.

Re: [Tutor] Running files from command prompt

2011-07-29 Thread Alexander Quest
le's class 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 wrote: > Alexander Quest wrote: > >> To clarify, the particular file that was giving me trouble was the basic >> &q

Re: [Tutor] Running files from command prompt

2011-07-28 Thread Alexander Quest
above truly is caused by version incompatibility). -Alex On Thu, Jul 28, 2011 at 7:58 PM, Alexander Quest wrote: > 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 g

Re: [Tutor] Running files from command prompt

2011-07-28 Thread Alexander Quest
again. -Alex On Thu, Jul 28, 2011 at 7:11 PM, Dave Angel 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.html<http:

[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] Assigning range

2011-07-27 Thread Alexander Quest
- > > middle_number = lambda lo, hi: abs(lo - hi) // 2 > > 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, A

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 wrote: > 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 r

[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

[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 d