Python bases in more than 128 words[Partie 3]

This article follows on from the first two parts that can be viewed here:

I am discussing the basics of the Python language to learn it quickly. In France these bases are taught in high school at the second SNT, first and senior NSI classes. They are also part of the knowledge program for CAPES NSI.


A tuple is an orderly collection like lists and immutable (that does not change).

exampleTuple ("apple," "pear," "strawberry")
print (exampleTuple)
print (exampleTupl[1]e)
print (exampleTu[-1]ple) #L negative indexing means from the end, -1 refers to the last element, -2 refers to the penultimate element, etc.
print (exampleTup[1:2]le) #Vous can specify an index range by specifying where to start and where to finish the range.
z - list (exampleTuple) #conversion tuple on the list
z[1] - "banana" 
x - tuple(z) #conversion tuple list

for x in exampleTuple: #Boucle on a tuple
  print (x) 

if "pear" in exampleTuple: #test of existence in a tuple
  print ("Yes") 


coordinates - (1.2,3)
x,y,z - coordinates
print (x)


A dictionary is an unordered, editable and indexed collection.

   "name": "Elodie"
   "age": "45"
   "year": 1980

print (custome["age"]r)
custo["nouvelleCle"]mer - "new value" #ajoute a new key and value
customer.get("solde") #renvoi 'None' because the key does not exist


The features allow the code to be organized into reusable pieces. In Python, a function is defined using the keyword def.

def exemple_fonction():
  print ("TestFunction")


The data can be switched to functions as a setting. You can add as many settings as you like, just separate them by a comma.

def exemple_fonction (first name):
  print ("Hello" - first name)

exemple_fonction ("John")
exemple_fonction ("Pierre")