Convertir du binaire au décimal
Fermé
afafarfa
Messages postés
1
Date d'inscription
vendredi 4 juillet 2014
Statut
Membre
Dernière intervention
4 juillet 2014
-
Modifié par afafarfa le 4/07/2014 à 12:47
papanou1965 Messages postés 37 Date d'inscription mardi 17 juin 2014 Statut Membre Dernière intervention 15 août 2014 - 17 juil. 2014 à 09:11
papanou1965 Messages postés 37 Date d'inscription mardi 17 juin 2014 Statut Membre Dernière intervention 15 août 2014 - 17 juil. 2014 à 09:11
A voir également:
- Convertir binaire en décimal python
- Ce programme est écrit en python. il construit un mot secret dans une variable mais il ne l'affiche pas. modifiez-le pour qu'il affiche le mot secret. exécutez-le. quel est ce mot secret ? ✓ - Forum Python
- Codage binaire - Guide
- Python est introuvable. exúcutez sans argument pour procúder ó l - Forum Python
- Convertir youtube en mp3 avec audacity - Guide
- Convertir heure en décimal excel ✓ - Forum Excel
2 réponses
jisisv
Messages postés
3645
Date d'inscription
dimanche 18 mars 2001
Statut
Modérateur
Dernière intervention
15 janvier 2017
934
Modifié par jisisv le 4/07/2014 à 18:03
Modifié par jisisv le 4/07/2014 à 18:03
A moins que ce ne soit un exercice (encore un exercice qui n'apprend pas à utiliser les outils préexistants et facilités d'un langage), ce code est inutile et imbuvable (pour calculer une puissance on utilise Horner, notamment )
Ceci suffit:
Utilise ton interpréteur préféré::
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
Ceci suffit:
string37='100101'
print(int(string37, 2))
Utilise ton interpréteur préféré::
>>> doc=int.__doc__
>>> print( doc )
int(x=0) -> integer
int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments
are given. If x is a number, return x.__int__(). For floating point
numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string,
bytes, or bytearray instance representing an integer literal in the
given base. The literal can be preceded by '+' or '-' and be surrounded
by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
Base 0 means to interpret the base from the string as an integer literal.
>>> int('0b100', base=0)
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)