Vous êtes sur la page 1sur 3

Exercice 1 :

20+1 221
20/3 6.666666666666667

20//3 6
20%3 2
5.45*10 54.5
2**4 16
(3+2)*5 25
3+2*5 13
"bonjour" ‘bonjour’
‘bonjour’ ‘bonjour’
"il fait"+ "beau" Il faitbeau
"il fait"+ "beau"+"et chaud" Il faitbeauet chaud
"bonjour"*5 'bonjourbonjourbonjourbonjourbonjour'

Exercice 2 :
20/0 ZeroDivisionError: division by zero

20@3 TypeError: unsupported operand


type(s) for @: 'int' and 'int'

"bonjour"/3 TypeError: unsupported operand


type(s) for /: 'str' and 'int'

"bonjour"+5 TypeError: can only concatenate str


(not "int") to str

(3+2))*5 SyntaxError: unmatched ')'

(3+2*5 SyntaxError: unexpected EOF while


parsing

Exercice 3 :
type(3) int
type(1.5) float
type(3.0) float
type("bonjour") string
type("3") string
type(3+1.5) float
Exercice 4:

age age=20 Age Entier


age=30 Prenom Chaine de caractère
prenom="perceval" Taille_m Réel
taille_m=1.80 Taille_cm Réel
taille_cm=100*taille_m Age Entier
age=age+3 Phrase1 Chaine de caractère
phrase1="bonjour"+prenom
phrase1=phrase1+ "!"
phrase2=prenom+"a"+str(age)+"ans" Phrase2 Chaine de caractère
print(phrase2)

Exercice 5:
nom="Motaz"
age=30
prenom="Motaz"
tel=96299103
adresse="Manar "
print(nom+prenom+str(age)+str(tel)+adresse)
Exercice 6:
nombre=input("donner un nombre:")
print(nombre[0:2])
print(nombre[0])
print(nombre[1])
print(nombre[2])
Exercice 7:
a=input("donner la valeur n1:")
b=input("donner la valeur n2:")
c=input("donner la valeur n3:")
d=a
a=b
b=c
c=d
print(a)
print(b)
print(c)

Vous aimerez peut-être aussi