[Courses] [python] Lesson 1: Hello world
akkana at shallowsky.com
Fri Jun 24 19:41:38 UTC 2011
Hrvoje G writes:
> 1. I was wondering if I could end lines with ";" as I'm used to that - turns
> out you can.
> print "Hello world" is the same as
> print "Hello world";
> - am I correct?
Yes, it should generally work, but I'd urge you not to do that --
you'll drive Python programmers crazy wondering why you put those
semicolons in there. :-)
They're there so that you can put two statements on the same line:
print "Hello" ; print "world"
but it's very rare to want to do that in Python -- I don't think
I've ever encountered it in a program.
> 3. I was wondering if I could multiply two numbers that I got from raw_input
> but it seems raw_input returns a string and it looks like Python doesn't
> convert types automatically.
Correct. I'll be talking about that in a later lesson.
More information about the Courses