Bitwise operators

I don’t understand the bitwise operators.

There is unit on Bitwise in Learn Python 3, if I’m not mistaken. That would be the unit to spend the week on. Be sure to do the background reading, as well.

But currently, I have been reading an article this person from this post gave me(is part of the Real Python website).
Person:
@toastedpitabread
Post:

But, I haven’t finished it.

Also none of my course content has ever taught me bitwise operations.

Will need to do some digging; was sure it came up somewhere; been wrong before.

BitwiseOperators - Python Wiki

If you are weak in the area of binary numbers, then dive into them and give it your whole week of study. Have an interactive shell open at all times so you can output expressions directly at the command prompt.

Binaries are string type data written in "" quotes preceded by `“0b”. Eg.

"0b101"

is a binary integer representing 2^2 + 2^0 => 4 + 1 => 5 in decimal.

It helps if we understand number bases, in particular decimal, octal, hexadecimal, and binary (base 10, 8, 16, and 2, respectively).

We need to use either an algorithm or a logarithm to convert from one base to another. An algorithm might involve subtraction in a loop and some other mechanics. A logarithm uses Exponent Laws to convert base. That’s what the log_factory outputs, a function that can convert to the base we have bound to it in the factory.

Anyway, you’ll need to get comfortable with the maths, not just the operators or Python code. If we misinterpret the maths, our code is never going to run as expected. You’ve spent a good amount of time on the coding, now is the time to spend it on the maths, including logic, once you get invested in the bitwise operators. It’s going to take a good deal of time and effort to bring your math prowess up to the level where this is even worth learning.

If I may ask, what level of Maths have you been exposed to in school?

I know what logarithms are but I think I can understand the bitwise operators by having a visual representation.

Get out the whiteboard, or a stack of paper. And, keep your interactive shell open.

>>> 1 << 4
?

What should be displayed?

>>> 256 >> 4
?

So I get out Visual Studio and go to the shell. Why isn’t there a shell in Visual Studio?
What’s wrong?

Is your installation is configured for C# then there must be a shell. Dig through the documentation. Sorry I cannot help since I don’t have VSCode configured for C#.

What do you have? (to remove character limit)

I’m vaguely on top of JS and Python, but in any production sense, a tinkerer. My game is snippets, not apps. But those snippets may be important bits of a future app. Programmers are thinkers, and tinkering is thinking, by my way of looking at it.

Do you create games? What field of programming are you interested in and do? Web Dev? Data Science? Data Analysis? Machine Learning? AI? Cybersecurity?