- 2
Please explain this code and output to me
It's a python code explain the working of code line by line which thing does what? https://code.sololearn.com/caGEo89Jzwyi/?ref=app
7 Answers
+ 5
Please read python language, don't ask that 'what is this'!!
We aren't teachers. You have downloaded the SOLOLEARN app for what?? For learning right? Then learn!
+ 4
it is always good to know how these things can be solved by using an algorithm. just to mention, that there is a bin() function that can do this also:
a=[10,11,12,13]
for num in a:
print("---",bin(num)[2:]) # [2: ] is a slice that cut out only the numbers part of the binary string "0b1010"
+ 3
Silentmaster8506
This problem is converting number to binary numbers
Explanation is given in code. I have just explained for number 10 now try to understand for other numbers.
https://code.sololearn.com/cS2u690xrQ2V/?ref=app
+ 2
Silentmaster8506 it's binary representation of decimal numbers 10,11, 12, 13
in decimal in binary(base2)
10 -----> 1010
11 -----> 1011
12 -----> 1100
13 -----> 1101
+ 1
Silentmaster8506 Google "how to convert a decimal into a binary number" and you'll understand it.
+ 1
The f-string also has such a functionality.
+ 1
#f-string
num=12
print(f"{num:b}")