Re: [Tutor] Noob: nested if-clauses

2016-01-30 Thread Alan Gauld
On 30/01/16 01:06, Alan Gauld wrote: > or CD to the folder: > > C:\SOME\PATH> CD D:\mycode\abc > D: > D:\mycode\abc> Oops, that sequence should be: C:\SOME\PATH> CD D:\mycode\abc C:\SOME\PATH> D: D:\mycode\abc> sorry about that. -- Alan G Author of the Learn to Program web site http://www.

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread Alan Gauld
On 29/01/16 17:41, STF wrote: > what that gives. IDLE is indeed easier to use than the "DOS-style" Python > command-line window. One thing I'd say is that you can tweak the DOS CMD window quite a lot to make it better for IDLE(and other interpreters). But IDLE is probably still better for most

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread John Wong
On Fri, Jan 29, 2016 at 3:13 PM, Alan Gauld wrote: > > When I first heard that python was white-space sensitive I > thought, oh no! But now I see it as a huge strength of the > language. Once you get used to it you will find it helps > far more than it hinders - just avoid tabs and/or map your >

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread boB Stepp
On Fri, Jan 29, 2016 at 11:41 AM, STF wrote: > ...How do you call this thing, BTW? I'm unable to > understand how to navigate inside this thing. I mean, when I open it, in > which folder am I in? Suppose I have a Python file in > D:\mycode\abc\myfile.py. How to run it? IDLE presents itself i

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread STF
On 25 January 2016 at 21:46, Alan Gauld wrote: > On 25/01/16 15:52, STF wrote: > > > It's a total fluke. I put the indentation like this to *visually* help > > myself understand what I was going to write. > > That's one of the good things about Python, if it looks right > it very often is right.

Re: [Tutor] Noob: nested if-clauses

2016-01-29 Thread Alan Gauld
On 29/01/16 17:41, STF wrote: > Personally, I don't find this as a "good thing". It rather recalls the > horrible dreams I have had when I was using Fortran! In Fortran, we have > to deal with position of first characters to make things work. IMO, making > a visual format an essential thing in

Re: [Tutor] Noob: nested if-clauses

2016-01-25 Thread Alan Gauld
On 25/01/16 15:52, STF wrote: > It's a total fluke. I put the indentation like this to *visually* help > myself understand what I was going to write. That's one of the good things about Python, if it looks right it very often is right. > In the Python tutorial that I was using, the author only

Re: [Tutor] Noob: nested if-clauses

2016-01-25 Thread Danny Yoo
> if condition_C: > instruction_10 >instruction_11 > instruction_12 > > There are 4 spaces in front of instruction_10, 3 spaces in front of > instruction_11 and 5 spaces in front of instruction_12. > > What would happen to instruction_11 and instruction_12? Would Python > ignore

Re: [Tutor] Noob: nested if-clauses

2016-01-25 Thread STF
Thanks to Joel and Alan for replying. On 24 January 2016 at 22:08, Alan Gauld wrote: > On 24/01/16 19:42, STF wrote: > > > Let's see the following instructions: > > > > if condition_A: > > instruction_1 > > instruction_2 > > if condition_B: > > instruction_3 > >

Re: [Tutor] Noob: nested if-clauses

2016-01-24 Thread Alan Gauld
On 24/01/16 19:42, STF wrote: > Let's see the following instructions: > > if condition_A: > instruction_1 > instruction_2 > if condition_B: > instruction_3 > instruction_4 > instruction_5 > else: > instruction_6 > > > * How to make Pythom understa

Re: [Tutor] Noob: nested if-clauses

2016-01-24 Thread Joel Goldstick
On Sun, Jan 24, 2016 at 2:42 PM, STF wrote: > Hi, > > I've just started to learn Python thru some online courses and websites. > They just teach very basic things. I've got some questions about "if" that > I'm unable to find the answers. So let me ask the newbie questions here. > > Let's see th

[Tutor] Noob: nested if-clauses

2016-01-24 Thread STF
Hi, I've just started to learn Python thru some online courses and websites. They just teach very basic things. I've got some questions about "if" that I'm unable to find the answers. So let me ask the newbie questions here. Let's see the following instructions: if condition_A: ins

Re: [Tutor] noob python question

2015-10-26 Thread Bob Gailer
Welcome to the tutor list. In order for us to help you please post the following: Python version Operating system The code you are running To trace back you are getting The trace back will be several lines of references to various programs and line numbers Once we have that information then it bec

Re: [Tutor] noob python question

2015-10-26 Thread boB Stepp
Greetings! On Sun, Oct 25, 2015 at 6:16 PM, bob5487 wrote: > Howdy! > > Reading *Learn Python the Hard Way* Zed Shaw > > All good so far but got to Ex 42 dealing with classes... > > I get a TypeError: getattr(): attribute name must be a string when I run the > program... > > I looked online, pyth

Re: [Tutor] noob python question

2015-10-26 Thread Asokan Pichai
Can you retype the question and your code? On 26 October 2015 at 04:46, bob5487 wrote: > Howdy! > > Reading *Learn Python the Hard Way* Zed Shaw > > All good so far but got to Ex 42 dealing with classes... > > I get a TypeError: getattr(): attribute name must be a string when I run > the > progr

Re: [Tutor] noob python question

2015-10-25 Thread Cameron Simpson
On 25Oct2015 16:16, bob5487 wrote: Reading *Learn Python the Hard Way* Zed Shaw All good so far but got to Ex 42 dealing with classes... I get a TypeError: getattr(): attribute name must be a string when I run the program... I looked online, python reference manual 3rd edition, etc... I was wo

Re: [Tutor] noob python question

2015-10-25 Thread Ben Finney
bob5487 writes: > Reading *Learn Python the Hard Way* Zed Shaw > > All good so far but got to Ex 42 dealing with classes... Can you give a URL to the exact code so that we can know we're seeing the same thing that you are? > I get a TypeError: getattr(): attribute name must be a string when I >

[Tutor] noob python question

2015-10-25 Thread bob5487
Howdy! Reading *Learn Python the Hard Way* Zed Shaw All good so far but got to Ex 42 dealing with classes... I get a TypeError: getattr(): attribute name must be a string when I run the program... I looked online, python reference manual 3rd edition, etc... I was wondering if anyone has experi

Re: [Tutor] noob

2010-11-29 Thread Andre Engels
On Mon, Nov 29, 2010 at 6:57 AM, Mary wrote: > Dear Tutors: > > Thank you for your time.I am trying to do first assignment (ps1a+b) onMIT > open study, finding the 1000th prime in part a and doing something with > import.math and logs in part b, but I'm not there yet. The little build i > did to f

Re: [Tutor] noob

2010-11-29 Thread Alan Gauld
"Mary" wrote finding the 1000th prime The little build i did to find primes does fine until, for some reason, 95 shows up, and later other multiples of 5 .Is it me? Have uninstalled and reinstalled 2.7 twice. It is always tempting when you start programming to assume there must be so

[Tutor] noob

2010-11-29 Thread Mary
Dear Tutors: Thank you for your time.I am trying to do first assignment (ps1a+b) onMIT open study, finding the 1000th prime in part a and doing something with import.math and logs in part b, but I'm not there yet. The little build i did to find primes does fine until, for some reason, 95 shows

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Alan Gauld
"Che M" wrote C:\Windows> python some\path\to\myscript.py That way you will still see the error message after the program finishes. Or what about using IDLE? Good point, although IDLE can bring its own problems. But for this case IDLE would be a good choice. -- Alan Gauld Author o

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Che M
> Start a CMD window and run the python command by typing the command > at the DOS prompt. > > eg > > C:\Windows> python some\path\to\myscript.py > > > That way you will still see the error message after the > program finishes. Or what about using IDLE? _

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Alan Gauld
"Joshua Harper" wrote Ok, so I am trying to learn python, and I am reading many tutorial type If you are just learning Python downgrade from 3.1 to v2.6. Most tutorials are not up to 3.1 yet and there are many differences. v3.1 was a big change to the language. eg. The following code is for

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Dave Angel
Michael Connors wrote: 2009/8/6 Joshua Harper Ok, so I am trying to learn python, and I am reading many tutorial type things and I am kind of stuck with implementing some of the code... so for example the tutorial says "*To get the examples working properly, write the programs in a text fil

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Robert Berman
On Thu, 2009-08-06 at 03:44 -0400, Joshua Harper wrote: > Ok, so I am trying to learn python, and I am reading many tutorial > type things and I am kind of stuck with implementing some of the > code... so for example the tutorial says "To get the examples working > properly, write the programs i

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Michael Connors
2009/8/6 Joshua Harper > Ok, so I am trying to learn python, and I am reading many tutorial type > things and I am kind of stuck with implementing some of the code... so for > example the tutorial says "*To get the examples working properly, write > the programs in a text file and then run that w

[Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Joshua Harper
Ok, so I am trying to learn python, and I am reading many tutorial type things and I am kind of stuck with implementing some of the code... so for example the tutorial says "*To get the examples working properly, write the programs in a text file and then run that with the interpreter*" Alright...s

Re: [Tutor] noob python cgi

2008-03-16 Thread Tyler Smith
On 2008-03-16, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > Tyler Smith wrote: >> Hi, >> [snip explanation] >> Three files follow. First, the html index page, followed by the >> gallery picker, followed by the thumbnail displayer. >> >> Thanks! >> >> Tyler >> [snip code] >> > In the future ple

Re: [Tutor] noob python cgi

2008-03-15 Thread Luke Paireepinart
Tyler Smith wrote: > Hi, > [snip explanation] > Three files follow. First, the html index page, followed by the > gallery picker, followed by the thumbnail displayer. > > Thanks! > > Tyler > [snip code] > In the future please include your code as attachments, to avoid e-mail programs mangling t

[Tutor] noob python cgi

2008-03-15 Thread Tyler Smith
Hi, I'm writing a webpage as a learning exercise. My first objective is to allow myself to upload files to directories in /images/, and have cgi scripts automatically generate the pages that will allow users to navigate through the images. I have a very basic prototype that does what I want, at l

Re: [Tutor] Noob requesting help...

2008-02-18 Thread bob gailer
This seems to focus on the NT, but from a Python Tutor List perspective I think we are OT. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Noob requesting help...

2008-02-18 Thread Marc Tompkins
Mother Mary comes to me Speaking words of wisdom: Let it be, let it be... On Feb 18, 2008 6:30 AM, Reed O'Brien <[EMAIL PROTECTED]> wrote: > On Feb 16, 2008, at 9:58 PM, bob gailer wrote: > > > Marc Tompkins wrote: > >> John, Luke, Marc... can we get a Matthew to join this thread? > > You thinkin

Re: [Tutor] Noob requesting help...

2008-02-18 Thread Reed O'Brien
On Feb 16, 2008, at 9:58 PM, bob gailer wrote: > Marc Tompkins wrote: >> John, Luke, Marc... can we get a Matthew to join this thread? > You thinking of Matthew Dixon Coles? > > But then wouldn't Paul want to get into the Act? For Pete's sake... ~ro __

Re: [Tutor] Noob requesting help...

2008-02-16 Thread bob gailer
Marc Tompkins wrote: > John, Luke, Marc... can we get a Matthew to join this thread? You thinking of Matthew Dixon Coles? But then wouldn't Paul want to get into the Act? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.o

Re: [Tutor] Noob requesting help...

2008-02-16 Thread Marc Tompkins
John, Luke, Marc... can we get a Matthew to join this thread? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Noob requesting help...

2008-02-16 Thread John Luke
Hi, I've recently started to get into Python, and I've made a bit a progress so far, but I still have a long way to go. Along my search for tutorials, I've come across this: # Waits until a password has been entered. Use Control-C to break out without # the password #Note that this must not be t

Re: [Tutor] Noob question

2007-12-12 Thread Dick Moores
At 01:43 PM 12/11/2007, Dick Moores wrote: >Concatenating strings is still VERY slow in CPython 2.5.1 compared to >using join(), however. See . Code slightly modified and moved to Dick __

Re: [Tutor] Noob question

2007-12-11 Thread wesley chun
> > > This is fairly inefficient. Because strings in python are immutable > > > this approach causes a new string to be created every iteration. > > > >This is not true of CPython (the standard python.org release) since > >version 2.4: > >http://www.python.org/doc/2.4.4/whatsnew/node12.html#SECTIO

Re: [Tutor] Noob question

2007-12-11 Thread Dick Moores
At 04:19 AM 12/11/2007, Kent Johnson wrote: >Eric Brunson wrote: > > Hi Amit, > > > > This is fairly inefficient. Because strings in python are immutable > > this approach causes a new string to be created every iteration. > >This is not true of CPython (the standard python.org release) since >ver

Re: [Tutor] Noob question

2007-12-11 Thread Kent Johnson
Eric Brunson wrote: > Hi Amit, > > This is fairly inefficient. Because strings in python are immutable > this approach causes a new string to be created every iteration. This is not true of CPython (the standard python.org release) since version 2.4: http://www.python.org/doc/2.4.4/whatsnew/no

Re: [Tutor] Noob question

2007-12-10 Thread Amit Saxena
Hi Eric, Thanks for the information..since i m new to Python so didnt knew about this fact...thanks again for it, will keep it in mind while writing such a program. Amit On Dec 10, 2007 8:57 PM, Eric Brunson <[EMAIL PROTECTED]> wrote: > > Hi Amit, > > This is fairly ineffici

Re: [Tutor] Noob question

2007-12-10 Thread Eric Brunson
Hi Amit, This is fairly inefficient. Because strings in python are immutable this approach causes a new string to be created every iteration. While it may not be an issue with just 3 strings, it is much better to create your list and use "".join() to create the concatenation after the list

Re: [Tutor] Noob question

2007-12-10 Thread Amit Saxena
The simplest way i could think of: a=["apple","orange","banana"] b = "" for i in range(len(a)): b += a[i] print b Amit On Dec 10, 2007 6:48 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Eric Walstad" <[EMAIL PROTECTED]> wrote > > > You could also achieve the same result of concatenating a

Re: [Tutor] Noob question

2007-12-09 Thread Alan Gauld
"Eric Walstad" <[EMAIL PROTECTED]> wrote > You could also achieve the same result of concatenating a list of > strings by looping over the list items like so: > > b = '' > for fruit in a: >b += fruit > > print b And to add to the options you could use the formatting operator provided you k

Re: [Tutor] Noob question

2007-12-09 Thread Eric Walstad
Eric Brunson wrote: > quantrum75 wrote: >> Hi there, >> I am a newbie trying to actively learn python. >> My question is, >> Suppose I have a list >> a=["apple","orange","banana"] >> >> How do I convert this list into a string which is >> >> b="appleorangebanana" >> Sorry for my ignorance, > > No

Re: [Tutor] Noob question

2007-12-09 Thread Eric Brunson
quantrum75 wrote: > Hi there, > I am a newbie trying to actively learn python. > My question is, > Suppose I have a list > a=["apple","orange","banana"] > > How do I convert this list into a string which is > > b="appleorangebanana" > Sorry for my ignorance, No worries, every new language has its

[Tutor] Noob question

2007-12-09 Thread quantrum75
Hi there, I am a newbie trying to actively learn python. My question is, Suppose I have a list a=["apple","orange","banana"] How do I convert this list into a string which is b="appleorangebanana" Sorry for my ignorance, but I have been trying a "for" loop and trying the inbuilt str.join() metho