Doubt regarding basic python operators!

codeOO7

Solid State Member
Messages
15
Location
India
Hello everyone,
I a beginner in python programming. Many of the doubts are arising in the path of learning it. Can anyone please explain me how the bitwise NOT (~) operator works in general when doing the compilation
Thanks in advance
[emoji846]Screenshot_2019-01-21-23-26-05-025_com.microsoft.office.word.jpg
 
I don't understand what you want to know. What do you mean by "when doing the compilation"? You want to understand how the low-level instructions work to flip the bits in the register?
 
I don't understand what you want to know. What do you mean by "when doing the compilation"? You want to understand how the low-level instructions work to flip the bits in the register?
No, actually I want to know how we apply the operator and get the answer without using a python console!
 
No, actually I want to know how we apply the operator and get the answer without using a python console!

All you have to do is flip the bits then. A NOT gate simply outputs the opposite of the input. If you send a 1, you'll get a 0.

If you look up a block diagram of a NOT gate you can get the idea of how it works.

Maybe you are having trouble understanding the literature because you don't know how 2's complement works. Look it up and maybe it'll be easier. Say you have 11001 -> NOT -> 00110. That's it.
 
All you have to do is flip the bits then. A NOT gate simply outputs the opposite of the input. If you send a 1, you'll get a 0.

If you look up a block diagram of a NOT gate you can get the idea of how it works.

Maybe you are having trouble understanding the literature because you don't know how 2's complement works. Look it up and maybe it'll be easier. Say you have 11001 -> NOT -> 00110. That's it.
Yeah, really I am having trouble with the 2's compliment. I also have doubt regarding the positive and negative sign of the number after using the operator!
 
Yeah, really I am having trouble with the 2's compliment. I also have doubt regarding the positive and negative sign of the number after using the operator!
I had trouble understanding 2's complement using textbooks alone, so I used YouTube instead. There are 10 minute videos that'll make you understand the system better than any textbook.

If your textbook has exercises about it somewhere I recommend you do a couple to get acquainted.

Before learning to code you should probably have a better understanding of computers in general. The book I used (and lots of universities use) is called "Computer Science: An Overview" by Glenn Brookshear. It covers a lot of topics that anyone interested in CS should know, including binary representations, among other cool things.
 
I had trouble understanding 2's complement using textbooks alone, so I used YouTube instead. There are 10 minute videos that'll make you understand the system better than any textbook.

If your textbook has exercises about it somewhere I recommend you do a couple to get acquainted.

Before learning to code you should probably have a better understanding of computers in general. The book I used (and lots of universities use) is called "Computer Science: An Overview" by Glenn Brookshear. It covers a lot of topics that anyone interested in CS should know, including binary representations, among other cool things.
Thanks allot for your valuable advice[emoji813]️
 
Back
Top Bottom