c'est une fonction qui convertit un entier en binaire .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 def bi(n): p=1 while p<=n: p=p*2 p=p//2 print(n,'=',end='') x=n while p!=0: if x//p==1: print('1',end='') x=x-p else: print('0',end='') p=p//2 if n==0: return 0
mais je ne comprend pas la fontion !!!
![]()
![]()
Partager