+ 2
Can any one tell me, how this work? (python)!
x = '101' y = int(x, 2) print('x =', x) print('y =', y) x = 101 y = 5
5 odpowiedzi
+ 4
x = '101'
y = int(x, 2)
print('x =', x)
print('y =', y)
x = 101
y = 5
x is already defined. Hope you know that.
y = int(x, 2)
It converts a string representing a binary number likewise,
y= int(x,8)
It converts it to octal
Btw, 101 represents 5 in decimal
+ 3
y = int(x,2) # 2 = 101 convert to binary to be 5 if you want to print 101 change 2 to 10
+ 1
Which language
+ 1
Simba that is a good explanation
0
HASHIM AL-EDRESI the code just prints the variable x and y