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/tutorial/introduction.html) and am having a few >>

Re: [Tutor] Newline question

2012-08-03 Thread Alan Gauld
On 03/08/12 22:09, Alexander Q. wrote: That was it Jerry- when I typed in "print hello" instead of just "hello", the output was exactly like the one in the tutorial. Yes, the interactive interpreter shows the representation (repr()) of the data while print shows the normal output. There are s

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 line command. > > > > The tutor

Re: [Tutor] Newline question

2012-08-03 Thread Jerry Hill
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 line command. > > The tutorial says that this code > > hello = "This is a rather long strin

[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] Newline

2010-12-04 Thread Alex Hall
On 12/4/10, Steven D'Aprano wrote: > Alex Hall wrote: >> On 12/4/10, Alan Gauld wrote: >>> "Steven D'Aprano" wrote >>> >>> for i in (1, 2, 3): ... print(i, "spam", end="\n" if i==3 else "***") >>> Ooooh! A new trick. >>> I hadn't thought of using the conditional expression there but

Re: [Tutor] Newline

2010-12-04 Thread ALAN GAULD
> >> ... print(i, "spam", end="\n" if i==3 else "***") > > > > I hadn't thought of using the conditional expression there but it > > makes a lot of sense. > So is this a python3.x feature only? Is there an equivallent in 2.x? I The end parameter of print is a Python 3 feature - only poss

Re: [Tutor] Newline

2010-12-04 Thread Steven D'Aprano
Alex Hall wrote: On 12/4/10, Alan Gauld wrote: "Steven D'Aprano" wrote for i in (1, 2, 3): ... print(i, "spam", end="\n" if i==3 else "***") Ooooh! A new trick. I hadn't thought of using the conditional expression there but it makes a lot of sense. Definitely more fun and flexible than

Re: [Tutor] Newline

2010-12-04 Thread Alex Hall
On 12/4/10, Alan Gauld wrote: > > "Steven D'Aprano" wrote > >> >>> for i in (1, 2, 3): >> ... print(i, "spam", end="\n" if i==3 else "***") > > Ooooh! A new trick. > I hadn't thought of using the conditional expression there but it > makes a lot of sense. > Definitely more fun and flexible th

Re: [Tutor] Newline

2010-12-04 Thread Alan Gauld
"Steven D'Aprano" wrote >>> for i in (1, 2, 3): ... print(i, "spam", end="\n" if i==3 else "***") Ooooh! A new trick. I hadn't thought of using the conditional expression there but it makes a lot of sense. Definitely more fun and flexible than the old comma at the end of a print in v2

Re: [Tutor] Newline

2010-12-03 Thread Hugo Arts
On Sat, Dec 4, 2010 at 3:04 AM, Rance Hall wrote: > Ava: > > On an old typewriter when you slapped that mechanical arm two separate > but related things happened. > > 1) the page advanced to the next line of text. > 2) the carriage was returnedt to the beginning of the line of text. > > If you wer

Re: [Tutor] Newline

2010-12-03 Thread Steven D'Aprano
Ashley Blackwell wrote: Hello everybody, I'm new to the mailing list so I'm pretty sure I'll have lots of questions:) It's a very basic question I have and everybody might look at this question and say, "Wow, she reallly doesn't get it?" But oh well. Here's my question: I'm in Chapter 2 of my Py

Re: [Tutor] Newline

2010-12-03 Thread Alex Hall
On 12/3/10, Ashley Blackwell wrote: > Hello everybody, I'm new to the mailing list so I'm pretty sure I'll have > lots of questions:) That is what the list is for. :) > > It's a very basic question I have and everybody might look at this > question and say, "Wow, she reallly doesn't get it?" But o

Re: [Tutor] Newline

2010-12-03 Thread Rance Hall
Ava: On an old typewriter when you slapped that mechanical arm two separate but related things happened. 1) the page advanced to the next line of text. 2) the carriage was returnedt to the beginning of the line of text. If you were careful about the way you slapped that mechanical arm, you could

Re: [Tutor] Newline

2010-12-03 Thread Walter Prins
Hello Ava/Ashley On 4 December 2010 01:47, Ashley Blackwell wrote: > Exactly what is a newline character? Not all characters used to encode information are printable/displayable characters like the letters in the alphabet or numerals or punctuation and symbols. There's several "special" chara

[Tutor] Newline

2010-12-03 Thread Ashley Blackwell
Hello everybody, I'm new to the mailing list so I'm pretty sure I'll have lots of questions:) It's a very basic question I have and everybody might look at this question and say, "Wow, she reallly doesn't get it?" But oh well. Here's my question: I'm in Chapter 2 of my Python Programming Third Edi

Re: [Tutor] newline problem

2010-08-21 Thread bob gailer
On 8/21/2010 2:36 PM, Roelof Wobben wrote: Hello, I have this programm : def print_digits(n): """ >>> print_digits(13789) 9 8 7 3 1 >>> print_digits(39874613) 3 1 6 4 7 8 9 3 >>> print_digits(213141) 1 4 1 3 1 2 """ count = 0 while n: count = count + 1

[Tutor] newline problem

2010-08-21 Thread Roelof Wobben
Hello, I have this programm : def print_digits(n): """ >>> print_digits(13789) 9 8 7 3 1 >>> print_digits(39874613) 3 1 6 4 7 8 9 3 >>> print_digits(213141) 1 4 1 3 1 2 """ count = 0 while n: count = count + 1 n = n / 10