#14 Python Tutorial for Beginners | Python BitWise Operators
ฝัง
- เผยแพร่เมื่อ 1 ส.ค. 2024
- Check out our courses:
Enterprise Java Spring Microservices: go.telusko.com/enterpriseJava
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : go.telusko.com/masterjava
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
Spring: go.telusko.com/udemyteluskosp...
Java:- go.telusko.com/udemyteluskojava
Java Spring:- go.telusko.com/Udemyjavaspring
Java For Programmers:- go.telusko.com/javaProgrammers
Python : go.telusko.com/udemyteluskopy...
Git : go.telusko.com/udemyteluskogit
Docker : go.telusko.com/udemyteluskodo...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
In this lecture we will learn:
- What are Bitwise operators in Python?
- Different types of bitwise operators
- How operations performed on bits
- Implementation of bitwise operations
#1
- In bitwise operations, the integers are first converted into binary and then operations are performed by bitwise operators on each bit or corresponding pair of bits.
- The result is returned in decimal format by the bitwise operators.
- There are six types of binary operators:-
1. Complement (~)
2. And (&)
3. Or (|)
4. XOR (^)
5. Left Shift
6. Right Shift
#2
- Complement operator is also known as tilde(~) operator.
- Complement simply do the reverse of binary form. If a bit is 0 then it makes it 1 and vice-versa.
- Reverse of each bit of a number returns the 1's complement.
- We can store only positive numbers in our system and that's why we find the 2's complement of each negative number.
2's complement = 1's complement +1
#3
-AND operator will return true if both the conditions are true while the OR operator will return true if at least one condition is true.
#4
- XOR operator will return 1 or true when there is an odd number of 1 bit present in operations and if there is an even number of 1, then it will return 0.
#5
- Leftshift operator shift bits on the left-hand side. The right-shift operator shifts bits on the right-hand side.
- Leftshift add the bits while the right-side removes the bits.
Github :- github.com/navinreddy20/Python-
Python for Beginners :- bit.ly/3JOLQhl
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com - วิทยาศาสตร์และเทคโนโลยี
print("nice teacher of python")
loop
the ans will be Navin Sir
Ans
nice teacher of python
🙌
@@asmit6555 also 11110011 is binary form of 243. So why did it gave -13 rather than 243??
We need lecturers like you in the colleges
so i wont go to college antmore, happy didn't happen
if that could be possible, my attendance would be 100%
@@adheshsuryatej8510 i know even if it happens your attendance still won't be 100%.
@@rajtiwari6645
😂
100%
Yes he is the Angel for the programming language,he is teaching very perfectly without doubts and easily in less time thank you so much sir if teachers like you are there in college every student become as a programmer☺
When I start learning with you I forget about questions,
You automatically tell everything
@Lightning Beast.X that’s not what he means lol
exactlyyy, cause I was searching for pi key and he was on cue
Can you say how to click right shift in windows 10
@@chandusugithi1822 it's shift+ less than symbol (
I am also aproduct from UCER
That was the best session as of now. I loved the way you make me understand the depth of a concept. I would love to learn from you in your next videos.
One of the best teachers I've found on youtube. Very clean explanation. Thank you.
My teacher explained this in class today and all I understood were the shifts, now I understand all biwise operators. Thank youuu !
I always had this problem figuring out the bitwise operators. But now I totally got them. Thank you 😊
very good videos..... actually this is the toughest one i had reached till now on his playlist of python programming
agree yaa this one is toughest till i saw
same
Awesome lesson. It really helped me understand left and right shift bitwise operators. Thank you!
Wow, you just explained what 4 teachers couldn't explain in years. Just became a fan of your's.
I have taken so many paid courses, but never got such a brilliant explanation as clear as water like yours. A teacher can build an entire nation and people like you are the face of India, people like you are directing the young towards success, showing path. That is why we see Indian people at top in Google, top doctors from India all around. This is because you care about the rest of the people of the country, patriotism! You are providing everything for free but in a much better way than our conventional education system. You earned my respect man, from heart!! Great job! Keep doing good to society!
One of the best programming teachers on TH-cam
Simply & Clearly Explained the concept of Bit wise Operator with calculation . Great Video series on Python.
I seen many videos on TH-cam to related this topic , but you explained this concept much better than others, thank you so much sir 😀
From class 10 I have been watching your channel. I never ever found anything complicated about your explanation. Mine every dought was crystal cleared by your videos. Thankyou so much sir. 👏👏👏👏👏
Navin reddy sir u r great and best teacher. I am a passionate coder. I like ur way of teaching.
I haven't studied this concept and after watching about 3 times I totally understood this.. thank you so much sir..🤗
Thanks for teaching . I am 15 and love programming thank you for being the most reliable resource and a great teacher for me.
I see Navin sir more than I see my friends nowadays XD
I am enjoying this series, nice explanations.
Thank you
isn't the binary of 12=1100 why is 000001100 used there
Even I'm getting the same doubt now
Sir, the way you teach is amazing. Even after being in a medical line I do not find any difficulty in understanding anything🙏🙏
i am very scared of coding but after watching your videos I got full confidence in myself that I can also learn programming language. thank you so much sir.
I've understood a concept which I couldn't since the first time! It's amazing how programming has helped me to learn math problems xD
yes
I am having so much fun, thank you.
Awesome the way you teach and a good approach of teaching the concepts first... After I watched your first video, there was no going back or looking for another !! Thank you
The good thing about learning from online videos is that you can playback multiple times on things you don't understand at first. Took me a bunch of playbacks to understand how Complement works.
You are the just the bestt..!!!! You are lord of the programming. Seriously I paid thousands to learn python but got no clarity. and look here this is freee and in the best representation!!! thanks naveen sir! you are doing a great job!
Now you need to get your thousands back ...but I guess it has been right-shifted (x >> 10) from your wallet 🙄
Wow i have been watching ur videos since 4 days daily and i loved this episode😍.....u are the best teacher in u tube .
me too
Same here
your teaching skill is just amazing... love you...💕
Sir your videos are very helpful and easily learnable.THANK YOU FOR THIS VIDEOS
Yes sir nice discussion.. Sir we want at least two quality, in depth, in detailed and easily discussed videos daily from such a great instructor/teacher like you.. Lots of love and respect for you sir 🙏🙏..
Thank you so much for this video. It was clear and easy to follow!
I have a good amount of python experience, but was still unfamiliar with this concept. I am glad you helped me :)
I'm very thankful to this channel which gives me better knowledge about technologies.... 💞💖💞💖💞
Zing Zing... Amazing Sir
Simply I loved your way of teaching sir.
Thanks for your vedios Sir
Hats off Sir... 👏👏👏🙏🙏🙏
That`s great clearly explained!!!
and also interesting by showing *Nokia 1100* Fantastic
It was quite funny & interesting. Maja aaya video dekhkar.
Yes.. by seeing nokia 1100 , python performance increased by 1100%
Thank you so much
You really made python easier for me
The ways you explained each concept is amazing.
Never thought it so easy....why my mind is so complicated before....thank you now I can keep my mind peace without thinking much about bitwise
teaching skills 💯
you got this subscriber sir 😊
>y) is equivalent to dividing x with 2^y.
Sir,It is making very interesting with ur resources and way of teaching
Thank u sir.. What u r offering us is such a great help for us as beginners. Lots of LOVE.
Sir as we know it is scripting language. Please,
Tell about how to make standalone executables from python.
Use of cython and jython.
Use of something which can convert all the python scripts to executables without any error for any library or for methods.
I mean to say that the technique should be universal.
I find difficulties in these topics.
Overall you are the best now on youtube. Whenever related to any java search query on youtube, your name comes first.
Quality video, audio with quality content.
print ("best teacher")
i very much enjoying this session sometimes i stuck at coding but i can easily get solution,
very nice teacher
Navin you re a hero without a cape , very appreciate for that lectures you deserve the best always .
Imperfect explanation for ~ operator
need help ~0 is -1 but he said 1??
and ~1 is -2
@@abhijeet800 short cut formula for ~ operator
~x=-x-1
~12=-12-1
=-13
similarly....~ -12 =-(-12)-1
=+12-1
=11
@@abhijeet800 he took an example buddy he used to say its reverse i.e., positive to negative
Thank u sir
For this treasure video..
You are super boss, I just can't believe that, now I have a deep concept about bitwise operetor. Best of luck for you.
Amazing way of teaching sir! Thank you so much 🙌
Iam from civil engineering,And i joined in Python Full stack development,But i don't know even basics,After searching good lecture for python, I find one of the best teacher for python is Navin sir , And this sir is teaching from scratch onwards, Now a days iam interested in python becz of you Navin sir 😌
now r you working or not..
i m also from civil thats why i ask..
@@YourMotivationCoach1 listen I'm not saying u will get job by python, You need to be good at some other skills which is related to software fields
@@Venu0916_2K then what should I have to do?
hi Navin quick question.,,
in the binary conversion of 12 i got 1100 how do you get "00001100" .
i realised same was done for bin(13) which is1101 but you have 00001101.
I'm so confused
Yes,I also got same doubt.
it is a 8-bit number
Short and precise crystal clear sir, kudos to you!!!
Sir you are great sir. Thanks a lot for all your videos.In this lockdown it is very much interesting and fun to learn python by watching your videos .
Thank you once again sir.🙏
Sir can you give some questions for practice in text file related to the the topic as homework, in the description? it will help us alot.
I am struggling to understand the use of this concept but I hope that would come sooner. Your videos are great but try to provide some of the future usages of the concept as well to keep us hooked. Thank you very much.
i love your unique style of teaching ^-^
Best python videos I could find on you tube, thank you very much!
Shifting bits to the left or to the right is the same as multiplying or dividing by powers of 2.
For example, shifting 2 bits to the left is the same as multiplying by binary 100, which is decimal 4 (that is, 2²), that's why 10
where exactly do we apply bitwise operators when we are programming; can u please make a tutorial for that please
easy to understand for me as a beginner, I recommend you to watching this
really impressed with this video, you explained this to a person who wouldn't understand in a great way. I came here from another language and was able to draw equivalent comparison, you did a great job. Earned a sub over here =)
Sir, your way of explaining is truely amazing
We can study and have fun at the same
Sir really amazing.
Hats off😊😊😊😊😊😊😊
Why 12 is 00001100 it should be only 1100 according to your previous video
Can someone please tell, why 8bit binary has been taken for ~12?
Have u got the ans???
yrr did u got the ans ?
00001100 is the same as 1100, just like 00012 is the same as 12
Zeroes to the left don't change the number.
zeroes before 1100 doesnt matter
awesome u r just superb....when i was in college that time i skip 2's complement and 1's complement due to i didnt understand all this this now i get how much interesting this topics....thank you
hats off to you sir,very impressive teaching!!!!
Hlo sir,
I am watching your video on python for long time and I found them much helpful. THANKS for making such an great videos for us
My question is what is the practical use for bitwise operators?
I'm learning it for my work because we create product labels using the Python Imaging Library (PIL), but in order to print them on our Zebra Printers we have to convert the labels to a byte array, invert the byte array (bitwise operator ^), convert them to hexadecimal, then write to the printer.
Basically, when sending data between systems we have to convert the datastream to binary.
By far the best I can search on TH-cam or any other education platform.
Indeed we need lecturers like you
Sir one doubt, during conversion of number into binary in IDLE, we get 12 to 0b1100, but you mentioned 12 as 00001100..I don't understand...please clarify it sir.
here 0000 represents that 12 is+ve number and 1111 rep that 13 is -ve number
@@yamisingh7433 thanks for clarifying.
Thank you for this!!
Really, you are great teacher. Thank you
omg, you're really good...I subscribed just after watching the 20 seconds intro part.
Today's Homework Completed 😀
1) The Complement number of 45 is 11010010 that is -46 and the complement number of 121 is 1000 0111 that is -122 .
2) (&) BIT Wise
When we entered 25&30 in shell we got 24 that is 11000 in binary form .
3) XOR (^)
25^30 we got 7 because 25 and 30 become 00111 that is 7
121 compliment is 10000110
for 25 weget 11001 and 30 we get binary form 11110 now the 25 and 30 means 11000 so output is 24
The component of 45 is 1111010010 which is -46 and the two complètements is 111101002. And the one of 121 compliment 11110000110 and gives -122 and the two complements 11110000111
In finding the complement of 12 in the paint you started to solve starting from 12 towards -13 and left it half way to come back from -13 into 12 using the 2complement formula but how would you solve the problem if you didn't know the complement was -13 in the first place.
Yeah I had the question in my mind too!😂
No he was saying that the 12 is equal to -13 in bits that's it.
@@omkarjsuvarna Got it 👍😊
Excellent explanation...it will be helpful for students from other branch also👌👌👌
Thank you for this, really quick and simple, super appreciated
Easy remebering of XOR
0 xor 0=|0-0|=0
1 xor 0=|1-0|=1
0 xor 1=|0-1|=1
1 xor 1=|1-1|=0
TQ bro
hahaha .....i follow this trick too
@@DineshThakur-hv1jz no it is correct
Trick bagundhi boss tq
@@lankasushma5105 welcome🤝
Easy way to remember the compliment, ~n means -(n+1). Ex: ~6, output will -7. or ~18, output will be -19... :D
Thank you ; )
thank you @chandan Hegada
Yes this is the part that he neglected to explain
Perfect Explanation. Thank you.
Wonderful explanation . Got interest on coding after listening to your classes
print("the way naveen sir teach is superb")
print("thank you")
I've a question about ~12 example that you explained. Answer for ~12 is -13 (you got this from running in Python IDLE) and then you derived -13 by performing 2's compliment. However, what if I don't know what is the actual of ~12? So, how do you really derive the answer for ~12?
same question
ur style of doing bye is amazing
Its just CRITICALLY FANTASTIC.
print('thank you')
10:18 "but we ignore zeros because they are zeroes"
zeroes - "Am i a joke to you?" 😂
Aryabhata wants to know your location
vow. bitwise operation in a 12 min video!. awesome!
Very good explanation Navin. Thank you!
Hi Navin,
Thanks firstly.
Doubt: when i put 0b11110011 and hit enter in IDLE it gives me 243 as the answer instead of "-13"...
I am using python3.8.3 now. and when I RUN bin(-13).. python gives -0b1101.
Please clarify this
+ same problem here
sir, if binary format for -13 is 11110011, then what is the binary format of 243??? is it same?
I too have this doubt
@Dileep Kumar actually no . the first number is used to represent sign that is 0 for + and 1 for - so only the last 7 bits of 8 bit is used to represent the value . For 243 , it uses 16 bit number to store in binary.
@@rgk1579 ^^
243 is a 16-bit number
Learning with you is really very interesting sir, one request Please upload the tutorials serial wise OR we have to search where the next is... Thanks a lot...
Thank you so much Navin, earlier I was struggling with this , now I got the concept
11110011 how can we tell this is -13 without compare this with result.
and how to convert 11110011 into number (-13)?
first --> subtract the binary number with 1 i.e., -1
second --> invert the number
third --> convert the number to decimal and add (-) symbol before it thats it
Same here I don't understand that too...
@@devkumarjacks201 go through most significant bit concept
Did you get the answer?? @shaik
You can use the bin() function to convert an integer into it’s bit sequence so:
>>>int_number = 4
>>>print(bin(int_number))
‘00000100’
Remember your output will be a string, hope this helps :)
sir binary format of 12 is 0b1100 then why 0000 at the start from where they came.
Yes bro same doubt
to convert it into 8 bit. he added 0000.
the preceding zeros, 0b1100 == 0b00000.....000001100
@@niviten why it's necessary to convert it to 8bit?
@@debabrataiam2019 : integer data type storage size is 1byte =8bits. All these values in integer data type therefor we are converting them to 8 bits.
Thank you very much sir, I am enjoying your class. Excellent explanation sir.
Excellent the way and methods by which you have taught the operators in python it helped easy grasping and implementation of the basics👌. Just awesome, love the way you teach❤