top of page
Rechercher

Représentation des nombres en langage Phyton

  • lilian0305060
  • 19 sept. 2022
  • 1 min de lecture

Testez chacune des instructions suivantes dans le shell d’un éditeur Python et expliquez leurs rôles

Écriture d’un entier positif :

>>> 0b1001

9

>>> 0x5d

93

Conversions :

Python 3.6.9

>>> bin(11)

'0b1011'

>>> int('0b1011',2) +1

12

>>> hex(195)

'0xc3'

Représentation approximative des nombres réels :

>>> 0.1+0.2

0.30000000000000004

>>> 0.1+0.2==0.3

False

>>> from math import*

>>> isclose(7.000000001,7)

True

>>> abs(0.1+0.2-0.3)<=10**-9

True

>>> round(1.235649,3)

1.236

 
 
 

Posts récents

Voir tout
Correction Exercices :

Exercice 1: Réponse B: E en binaire = 1110 et D en binaire = 1101 Exercice 2: Réponse C: 15 en bianire = 1111 (voir tableau) Exercice 3:...

 
 
 
Projet 2

Corrigez ce programme ci-dessous pour avoir l'addition des nombres binaires 01010001 00110011 n = [] p = [] r = [] c = False for i in...

 
 
 

Comentarios


Bonjour et merci pour votre visite !

Paragraphe. Cliquez ici pour ajouter votre propre texte. Utilisez cet espace pour relater votre parcours et présenter votre activité à vos visiteurs.

Pour recevoir
toute mon actu

Merci pour votre envoi

  • Facebook
  • Instagram
  • Twitter
  • Pinterest
bottom of page