Table of Contents
- Importation du module random
- Importation du module math
- Importation du module sys
- Bilan
- Pour aller plus loin
Importation du module random
import random
for i in range(20):
print(random.randint(1, 10))
from random import *
for i in range(20):
print(randint(1, 10))
Importation du module math
import math
phi = (1 + math.sqrt(5)) / 2
print(phi)
print(math.pi)
from math import *
phi = (1 + sqrt(5)) / 2
print(phi)
print(pi)
Importation du module sys
import sys
while True:
print('Taper "exit" pour sortir.')
reponse = input()
if reponse == 'exit':
sys.exit()
print('Vous avez tapé ' + reponse + '.')
from sys import *
while True:
print('Taper "exit" pour sortir.')
reponse = input()
if reponse == 'exit':
exit()
print('Vous avez tapé ' + reponse + '.')
Bilan
Dans ce cours nous avons vu :
- 3 exemples de modules
random,mathetsys - 2 façons pour importer un module
Pour aller plus loin
- La vidéo sur YouTube :
- La formation pour apprendre à coder une blockchain avec Python :
ACBP - La formation pour découvrir les technologies blockchain : CDBSSR
- La formation pour devenir full stack developer : FSD
- Le pack avec un paiement en 10 fois :
https://glmp.systeme.io/pack-3-formations-10-fois