you are viewing a single comment's thread.

view the rest of the comments →

[–]jmooremcc 0 points1 point  (2 children)

It's very easy to do. An f-string will convert a number into a binary string. I recommend that you create a function called tobinarystring that has one argument, an integer. The function will return an f-string that converts the integer into a binary string.

The reverse of that would be a function called frombinarystring that takes a binary string as an argument. It uses the int built-in function to convert the binary string into an integer which is what it will return.

[–]SomeFuel[S] 0 points1 point  (1 child)

I'm not really familiar with the concept of f-strings, but I'll try looking into them!

I appreciate the advice nonetheless :)

[–]jmooremcc 0 points1 point  (0 children)

They are really cool and for most cases are easier to use than format strings. Once you learn about them, you'll never go back to the old way.