for i in range(0, 231, 23):
print(i)
notes = [12, 15, 18, 10]
for i in range(len(notes)): # len(notes) = 4, donc i va de 0 à 3
notes[i] = notes[i] + 2
print(notes)
fruits = ["pomme", "banane", "orange"]
for i, fruit in enumerate(fruits):
print(i, fruit)
caca = [12, 15, 18, 10]
caca.append(20) # ajoute 20 à la fin
caca.remove(15) # supprime 15
caca.sort() # trie par ordre croissant
caca.reverse() # inverse l’ordre
print(caca)
note = [12, 15, 18, 10]
note_plus2 = [n + 2 for n in note]
print(note_plus2) # [14, 17, 20, 12]
eleve = {
"nom": "Robin",
"age": 14,
"classe": "4e",
"Statut": "big boss des échecs"
}
print(eleve["nom"]) # Alice
eleve["age"] = 15 # modifier une valeur
print(eleve)
for cle, valeur in eleve.items():
print(cle, ":", valeur)
x = 5
message = "Pair" if x % 2 == 0 else "Impair"
print(message)
import random
choix = random.choice(["rouge", "bleu", "vert"])
print("La couleur choisie est :", choix)
from math import pow
print(pow(3,4)) # 27
To embed this project on your website, copy the following code and paste it into your website's HTML: