Your first program !


In [1]:
print('Hello World !')


Hello World !

Two notions:

String = characters enclosed by singles or double quotes


In [3]:
a = 'jesuisunechaine'
b = "moiaussi!!!"

In [4]:
print(a)
print(b)


jesuisunechaine
moiaussi!!!

Strings (which are objects) can be stored into a variable. You name the variable as you want. There is no character type (only 1-length string...)


In [8]:
c = a + b
c = a + b + "..."

You can construct a new string using the add operator which concatenates two (or more) different strings.

Introducing the numbers (and the typing...)


In [6]:
a = 3 
b = 5.0

In [7]:
print(a)
print(b)


3
5.0

We have numbers. Remarks:


In [9]:
print(type(a))
print(type(b))


<class 'int'>
<class 'float'>

You can check the type of any objects using the type()function. Prefer isinstance() for program check

You have access to basic math operations:


In [10]:
c = a + 1
d = (a * b) + 2
e = d / a

Flow Statement: If if if if if !

if :

if not :


In [ ]: