Re: [Tutor] Newline question

2012-08-03 Thread Alexander Q.
On Fri, Aug 3, 2012 at 2:09 PM, Alexander Q. wrote: > > > On Fri, Aug 3, 2012 at 1:40 PM, Jerry Hill wrote: > >> On Fri, Aug 3, 2012 at 4:18 PM, Alexander Q. >> wrote: >> > I'm following the tutorial from python.org >> > (http://docs.python.org/

Re: [Tutor] Newline question

2012-08-03 Thread Alexander Q.
On Fri, Aug 3, 2012 at 1:40 PM, Jerry Hill wrote: > On Fri, Aug 3, 2012 at 4:18 PM, Alexander Q. wrote: > > I'm following the tutorial from python.org > > (http://docs.python.org/tutorial/introduction.html) and am having a few > > indiscrepancies regarding the new

[Tutor] Newline question

2012-08-03 Thread Alexander Q.
I'm following the tutorial from python.org ( http://docs.python.org/tutorial/introduction.html) and am having a few indiscrepancies regarding the new line command. The tutorial says that this code hello = "This is a rather long string containing\n\ several lines of text just as you would do in C.

Re: [Tutor] Calling a function does not return what I want it to return

2012-07-19 Thread Alexander Q.
On Thu, Jul 19, 2012 at 4:21 PM, Dave Angel wrote: > On 07/19/2012 06:58 PM, Alexander Q. wrote: > > I have this little program that is supposed to calculate how many > diagonals > > a polygon of x sides has, but it does not return what I have in the > > "return"

[Tutor] Calling a function does not return what I want it to return

2012-07-19 Thread Alexander Q.
I have this little program that is supposed to calculate how many diagonals a polygon of x sides has, but it does not return what I have in the "return" part of the function when I call it. Here is the code: def num_diag(var): ans = 0 if var <= 3: print("No diagonals.") else: for i i

[Tutor] Regular expressions: findall vs search

2012-07-10 Thread Alexander Q.
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] Returning multiple objects from a function

2012-07-03 Thread Alexander Q.
On Mon, Jul 2, 2012 at 8:56 PM, Dave Angel wrote: > On 07/02/2012 10:23 PM, Alexander Q. wrote: > > I understand the basics of tuples, but that formulation returned the > > following error: > > > > Traceback (most recent call last): > > File "C:\Users\Ow

Re: [Tutor] Returning multiple objects from a function

2012-07-02 Thread Alexander Q.
parens? In that case, how would I access list1 and list2 when needed? Thanks for your help. On Mon, Jul 2, 2012 at 4:11 PM, Walter Prins wrote: > On 2 July 2012 23:55, Alexander Q. wrote: > > Hello- I'm wondering how to access specific objects returned from a > function > > wh

[Tutor] Returning multiple objects from a function

2012-07-02 Thread Alexander Q.
Hello- I'm wondering how to access specific objects returned from a function when that function returns multiple objects. For example, if I have "return(list1, list2, list 3)" within a function "mainFunc()" that takes no arguments, how do I use list1, list2, and list3 outside of the function once