Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 01-21-2019, 12:57 PM   #1
Solid State Member
 
codeOO7's Avatar
 
Join Date: Dec 2018
Location: India
Posts: 15
Default Doubt regarding basic python operators!

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
Screenshot_2019-01-21-23-26-05-025_com.microsoft.office.word.jpg
__________________

__________________
codeOO7 is offline   Reply With Quote
Old 01-21-2019, 04:21 PM   #2
Fully Optimized
 
AMD_man's Avatar
 
Join Date: Dec 2016
Location: Argentina
Posts: 1,604
Default Re: Doubt regarding basic python operators!

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 so enjoy watching history warp as words pass
from the lips of one to the ears of another.
Imperfectly formed, half understood, poorly remembered."
AMD_man is online now   Reply With Quote
Old 01-22-2019, 12:39 AM   #3
Solid State Member
 
codeOO7's Avatar
 
Join Date: Dec 2018
Location: India
Posts: 15
Default Re: Doubt regarding basic python operators!

Quote:
Originally Posted by AMD_man View Post
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!
__________________
codeOO7 is offline   Reply With Quote
Old 01-22-2019, 12:05 PM   #4
Fully Optimized
 
AMD_man's Avatar
 
Join Date: Dec 2016
Location: Argentina
Posts: 1,604
Default Re: Doubt regarding basic python operators!

Quote:
Originally Posted by codeOO7 View Post
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.
__________________
"I so enjoy watching history warp as words pass
from the lips of one to the ears of another.
Imperfectly formed, half understood, poorly remembered."
AMD_man is online now   Reply With Quote
Old 01-24-2019, 04:36 AM   #5
Solid State Member
 
codeOO7's Avatar
 
Join Date: Dec 2018
Location: India
Posts: 15
Default Re: Doubt regarding basic python operators!

Quote:
Originally Posted by AMD_man View Post
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!
__________________
codeOO7 is offline   Reply With Quote
Old 01-24-2019, 09:01 AM   #6
Fully Optimized
 
AMD_man's Avatar
 
Join Date: Dec 2016
Location: Argentina
Posts: 1,604
Default Re: Doubt regarding basic python operators!

Quote:
Originally Posted by codeOO7 View Post
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 so enjoy watching history warp as words pass
from the lips of one to the ears of another.
Imperfectly formed, half understood, poorly remembered."
AMD_man is online now   Reply With Quote
Old 01-24-2019, 10:45 AM   #7
Solid State Member
 
codeOO7's Avatar
 
Join Date: Dec 2018
Location: India
Posts: 15
Default Re: Doubt regarding basic python operators!

Quote:
Originally Posted by AMD_man View Post
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
__________________

__________________
codeOO7 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 08:25 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0