1.2.1. First Steps: "Hello, World!"
1.2.1. First Steps: "Hello, World!"
>>>
The message Hello, world! is then displayed. You just executed your first Python instruction,
congratulations!
>>>
Two variables a and b have been defined above. Note that one does not declare the type of an
variable before assigning its value. In C, conversely, one should write:
int a = 3;
In addition, the type of a variable may change, in the sense that at one point in time it can be equal to
a value of a certain type, and a second point in time, it can be equal to a value of a different type. b
was first equal to an integer, but it became equal to a string when it was assigned the value 'hello' .
Operations on integers ( b=2*a ) are coded natively in Python, and so are some operations on strings
http://scipy-lectures.github.io/intro/language/first_steps.html
1/2
11/16/2014
such as additions and multiplications, which amount respectively to concatenation and repetition.
http://scipy-lectures.github.io/intro/language/first_steps.html
2/2