[Courses] [python] Lesson 1: Hello world

Holly Bostick aka.motub at gmail.com
Wed Jun 22 13:23:23 UTC 2011


Hey, sorry to be late to class, but at least I've got my homework :) .


> ================= Homework =========================
>
> Normally I'll have programming assignments for homework -- some easy,
> some harder. But for this first lesson, I just have a few questions.
> Post your answers to the list -- if someone beats you do it, don't
> worry about it, you're not being graded on who answers.
>
> 1. I'm interested in hearing what version of Python everybody is running,
>    on which operating system, distro and version. Please post your results!
>    Especially if python3 is the default, or if you have any other problems
>    running the examples.
>
> 2. Why are there two commas in
>     print "Hello,", name
>     ? What do you think the difference is between them?
>
> 3. Anyone know why the language was named Python?
>
>
1.  Python version 2.6.6 under Linux Mint Debian Editon (LMDE). No distro
version as it's a rolling release based on Debian Testing.

2. I did know that the first comma was part of the "print-as-is" string due
to being enclosed in quotes, and that the second was a signifier that a
variable would follow to be printed, but I then overthought it, trying to
figure out where the space came from.

In wondering about why I overthought it after reading the rest of the
replies, I realized that I had not understood that *the entire
line*comprises the 'print' statement, not just what was in the quotes.
So now I
want to know-- how do you know when the command has 'ended' ? Is it just by
putting a hard return to the next line, as in the extended example that
includes user input? If so, what if I wanted to print two lines that had a
hard return between them? For example, if I wanted the answer to "What is
your name" to be printed on the next line (which would look better)? I
imagine there's an escape character to signify that....?

My other question is about that space. If the space in the output "Hello,
Holly" is added by the comma, then the space between , and name is a "null
character"?  (Yes, indeed it is; I changed ", name" to ",name" and I still
got "Hello, Holly".) So does that mean that the space between the Python
function signifier and the remaining content is for human-readability
purposes, but otherwise not strictly required?

3. As for the Python name, I read the answer(s), but I could have sworn that
the symbol for python was at some point a snake, if it isn't still. Otoh, I
suppose that there couldn't really be a reasonable and affordable
symbol/icon for Monty Python's Flying Circus...

Thanks for the course! I'm having fun and learning already!

Holly


More information about the Courses mailing list