Do You Actually Know Python??

This short video explains the exclusive or (xor) operator and how it may be confusing with the power operator.
Background Music:
Gentle Lo-Fi Vlog Background Music | Cookies by Alex-Productions | onsound.eu/
Music promoted by www.free-stock-music.com
Creative Commons Attribution 3.0 Unported License
creativecommons.org/licenses/...

Пікірлер: 123

  • @QuestioningYourSanity
    @QuestioningYourSanity Жыл бұрын

    This is why I code every day and still don't call myself a programmer.

  • @murderspree

    @murderspree

    Жыл бұрын

    what type of stuff do you code? i have been programming since 2016 and i cant find anything to code anymore..

  • @Mr.Fantomblox

    @Mr.Fantomblox

    Жыл бұрын

    @@murderspree there is always something new on leetcode

  • @ygx6

    @ygx6

    Жыл бұрын

    @@murderspree personally I just do freelancing projects

  • @Arjun----

    @Arjun----

    Жыл бұрын

    ​@@murderspree neural networks/ML/Data science, build apps in java, game design, and like people mentioned, leetcode and freelancing

  • @bdav0

    @bdav0

    Жыл бұрын

    @@murderspree learn a new language, hone your skills, etc - there’s always something to do I’ve been writing code since 2012, but really programming since like 2020

  • @n00bxl71
    @n00bxl71 Жыл бұрын

    Hahaha You can't fool me ^ is a bitwise XOR operator, not an exponent.

  • @stormswindy3013
    @stormswindy3013 Жыл бұрын

    “how well do you actually know python” sir, i use C++

  • @IonicMC

    @IonicMC

    6 ай бұрын

    Same

  • @yesil_hiyar7335
    @yesil_hiyar7335 Жыл бұрын

    I knew what it was, i just had no idea what it does

  • @chuchichastli3809

    @chuchichastli3809

    Жыл бұрын

    Its calculating what you just did... That is not code😅

  • @samueljehanno

    @samueljehanno

    Жыл бұрын

    ​@@chuchichastli3809 you didn't get it

  • @ifeanyi9295
    @ifeanyi9295 Жыл бұрын

    I was totally thinking mathwise

  • @floskater99
    @floskater99 Жыл бұрын

    Started with C, so i know the Bitwise Operators, can't fool me 😎

  • @epsi
    @epsi Жыл бұрын

    Fun fact: the boolean equivalent of a bitwise XOR operator is the inequality operator != . This can be used, for example, to check whether two numbers are both negative (same sign), both positive (same sign), or one is positive while the other is negative (different signs): if (a # one is positive and one is negative (different signs) else: # both positive/both negative (same sign) This is also how the bitwise operation works on individual bits, which can only be 1 (True) or 0 (False), so if they're the same, you get 0 (False) as the output, else you get 1 (True). It follows that if ^ is for bitwise XOR, and != is the boolean equivalent, then == is the boolean opposite, which means ~(a ^ b) is the bitwise opposite (only selects the bits that are equivalent): ~(0b00000010 ^ 0b00000100) → ~(0b00000110) → 0b11111001 a&b - selects bits that are set in both a and b ~(a&b) - selects bits that are NOT set in a or NOT set in b or NOT set in both a and b a|b - selects bits that are set in a or set in b or set in both a and b ~(a|b) - selects bits that are NOT set in both a and b a^b - selects bits that are NOT equal in a and b, i.e. set in a or set in b, but NOT set in both a and b ~(a^b) - selects bits that are equal in a and b, i.e. NOT set in a and NOT set in b, or set in both a and b The only potential problem with ~ is the fact that it will flip hidden leading 0s to leading 1s, which results in a negative value, so beware!

  • @bgnoodle4325
    @bgnoodle432510 ай бұрын

    I LEARNED SOMETHING NEW!

  • @tatejackson3512
    @tatejackson3512 Жыл бұрын

    Dude that's crazy I have been studying python for a short while I plan on making it my career I actually did this one correctly

  • @juxyper
    @juxyper Жыл бұрын

    even though i know the answer to this my math brain always tells me that it is an exponent

  • @PeterStoyanov-Pepe
    @PeterStoyanov-Pepe Жыл бұрын

    Thank you for the useful information

  • @ByteBeacon9660
    @ByteBeacon9660 Жыл бұрын

    Im lucky I watched a video on that just last week 😎

  • @NamNguyen-mz4yh
    @NamNguyen-mz4yh Жыл бұрын

    Damn most people are still misunderstanding ^ is exponential

  • @s1l3nttt

    @s1l3nttt

    Жыл бұрын

    No shit python is dumb as fuck, next they'll change the + signal to mean a hashmap

  • @heroes-of-balkan
    @heroes-of-balkan Жыл бұрын

    How I managed to forget the bitwise XOR operand? I thought since this is a quiz question about Python, there must be something about "pythoning" features. It ends up about simple logic in any programming language

  • @adkharu
    @adkharu Жыл бұрын

    I believe XOR is pronounced "ex or" as in 'exclusive or'.

  • @b001

    @b001

    Жыл бұрын

    I think you’re right, but my brain has always pronounced it “zor” and I can definitely see how that may confuse people

  • @hashirkz

    @hashirkz

    Жыл бұрын

    @@b001huh ive also always called xor zor lol

  • @tzabarpho.

    @tzabarpho.

    Жыл бұрын

    ​@@hashirkz lol I call it kcsor

  • @philstanton8912

    @philstanton8912

    Жыл бұрын

    yeah it’s technically “ex or” or thats i’ve heard it called my entire life. See were zor comes from tho

  • @moranii1843

    @moranii1843

    Жыл бұрын

    Nah

  • @The9thDoctor
    @The9thDoctor Жыл бұрын

    Whoops. I knew it was a bitwise, but thought it was OR not XOR

  • @RajaSekhar-uj8bb
    @RajaSekhar-uj8bb9 ай бұрын

    Super

  • @mehmetenescetin2182
    @mehmetenescetin2182 Жыл бұрын

    Bro aint foolin no one

  • @moon911x
    @moon911x Жыл бұрын

    c++ learners on fire 🔥😅

  • @irp3ex
    @irp3ex Жыл бұрын

    i didn't know about this and thought it will return an error

  • @yglyglya
    @yglyglya11 ай бұрын

    ^ and ** are confusing)

  • @user-bg1xh3yl5o
    @user-bg1xh3yl5o Жыл бұрын

    XORing any value by itself is 0 btw so it’s not really “in our case” like he said it’s just always like that

  • @theliteralcow
    @theliteralcow Жыл бұрын

    I confused ^ with / and still got it right

  • @pyp2205
    @pyp2205 Жыл бұрын

    Somehow even though I knew that the Python operator for raising a number by a power is double star (**). I didn't notice the mistake until it was shown.

  • @yungvenuz
    @yungvenuz Жыл бұрын

    mistook that for AND operation

  • @vlvbeats517
    @vlvbeats517 Жыл бұрын

    Woow, well this was something that I didn’t know about

  • @64imma
    @64imma Жыл бұрын

    I've been seeing these bitwise operators pop up and while I understand the general concept that these compare the bits, I suppose I'm just not understanding why we would want to do this. Can you explain the application for these bitwise operators?

  • @rksmehul

    @rksmehul

    Жыл бұрын

    Not that useful. One use is bitmasking

  • @nyverinorlyth9555

    @nyverinorlyth9555

    Жыл бұрын

    I write mostly rust and sometimes C and ASM code, bitwise operations are very useful when optimizing some operations, I can see why it may not be as common to use in python.

  • @undercover4874

    @undercover4874

    Жыл бұрын

    Ever wondered for any case we need a an array of bool type just to store 1 and 0. a single variable is 4 bytes meaning '32' bits only one of them.is used. Why not we use all of the 32 bits when we just want to store a single 1 and 0. well thats when we need bitwise operators to manipulate individual bits and turn them on or off get them its more space efficient this way.

  • @benp2291

    @benp2291

    Жыл бұрын

    Bitwise xor is useful for a quick encryption, say x is plain text and k is our key. If I showed you x^k, you wouldn’t be able to know what x was - there’s no way to undo a bitwise xor unless you knew what k was, because (x^k)^k=x

  • @devilOzz
    @devilOzz Жыл бұрын

    XOR

  • @mzakyr342
    @mzakyr342 Жыл бұрын

    Xor

  • @sensiblermensch7167
    @sensiblermensch7167 Жыл бұрын

    btw the square of (x-1) would be: (x-1)**2

  • @fruitfcker5351
    @fruitfcker5351 Жыл бұрын

    Hmmm. Seems I need to take out Python for dinner more often.

  • @greenfire2783

    @greenfire2783

    Жыл бұрын

    Maybe put a guard on it's mouth so it doesn't bite you

  • @zxopink
    @zxopink Жыл бұрын

    Not a python dev, got it right. It's more like how well you know C/C++

  • @essayedgar
    @essayedgar Жыл бұрын

    If we’re gonna be 🤓 then you should also know it’s not called the power operator but the exponent(iation) operator

  • @theorange6460
    @theorange64604 ай бұрын

    Python uses ** as a power operator

  • @freenightowl8514
    @freenightowl851411 ай бұрын

    any way to have it print the binary results; so you can read them? For example print 22 in binary

  • @juggiebonebrain3383
    @juggiebonebrain3383 Жыл бұрын

    ** is the exponent operator

  • @felixplatzer3924
    @felixplatzer3924 Жыл бұрын

    when would you need this operator for example?

  • @floskater99

    @floskater99

    Жыл бұрын

    Whenever you want to do Bitwise XOR. Probably never. It‘s more commonly used in C, noone uses it in Python.

  • @shamu5943
    @shamu5943 Жыл бұрын

    F.... I did indeed

  • @anmekazaki5185
    @anmekazaki5185 Жыл бұрын

    Me who just did (a-b)^2 from my maths class and made x=1 :d

  • @FYIWDWYTM69
    @FYIWDWYTM695 ай бұрын

    I said 2..but ive only been learning python for 4 dsys now...

  • @swordsimkid23
    @swordsimkid23 Жыл бұрын

    Hahaha you can fool me kept thinking that ^ was an exponent not a bitwise XOR operator

  • @adviksingh6181
    @adviksingh6181 Жыл бұрын

    which font are you using?

  • @GyroZeppeli_
    @GyroZeppeli_ Жыл бұрын

    People dont confuse ^ with ^ ^ . ^ is XOR and ^ ^ is power

  • @dollymathew1347
    @dollymathew1347 Жыл бұрын

    Which coding engine used in this video

  • @suryac850
    @suryac850 Жыл бұрын

    A number xor itself will be 0 always. It's basic CS concept

  • @Cloud_Insights
    @Cloud_Insights Жыл бұрын

    What editor is this?

  • @Eagle-Fly
    @Eagle-Fly Жыл бұрын

    Ya Xor exists, knew this one

  • @Xazirt
    @Xazirt5 ай бұрын

    which font u using?

  • @dannycameron
    @dannycameron Жыл бұрын

    As an electronic engineer, this is not ZOR. Don't make it a thing

  • @s1l3nttt
    @s1l3nttt Жыл бұрын

    The more I watch your shorts, the more I am thankful I learnt c# and not python

  • @sustrackpointus8613

    @sustrackpointus8613

    Жыл бұрын

    Wdym, u dont know there is xor operator in c# or u dont want to deal with community of people that just got into coding?

  • @Victone224
    @Victone224 Жыл бұрын

    Name of the app And I want the name of the python app to install for PC(window 7)

  • @Nemo42239
    @Nemo42239 Жыл бұрын

    What do you use ^ for then?

  • @Nemo42239

    @Nemo42239

    Жыл бұрын

    @@qwerty_qwerty ok what do you use the xor operator for?

  • @mrgamer-lu1im
    @mrgamer-lu1im Жыл бұрын

    Output: 0. Anything xored to it self is zero

  • @grin4329
    @grin4329 Жыл бұрын

    I got it right but with the wrong formula

  • @managMent_
    @managMent_ Жыл бұрын

    Wouldn't have been fooled if this was any C like language, but Python likes to just do random magic to "make a programmers life easier" and randomly decides not to at other spots. Python is the only language where I can totally see this operator being used as a power operator.

  • @thethiny
    @thethiny Жыл бұрын

    That's every programming language. Also it's X Or not ZOR

  • @fasty93
    @fasty936 ай бұрын

    WTF ^ is literally or how- well anyways at least I know how to xor now

  • @Noah-gw9cg
    @Noah-gw9cg Жыл бұрын

    The ZOR operator?? 😭😭😭

  • @Rainmakeroffire

    @Rainmakeroffire

    Жыл бұрын

    Have no fear, XORRO is here

  • @luisferretiz7478
    @luisferretiz7478 Жыл бұрын

    Ya got me :(

  • @cherubin7th
    @cherubin7th Жыл бұрын

    Python is such a bad language. E. g. in Rust ^ is an exponential as it should be.

  • @Oscar-vs5yw
    @Oscar-vs5yw Жыл бұрын

    Im stupid, got myself to think it was (2x-1)^2 and then 5 is 101 ^ 10 = 101 ... there was no 5 and i got over confused 😂

  • @alexander_richter
    @alexander_richter Жыл бұрын

    I knew that

  • @abhigyanchatterjee7944
    @abhigyanchatterjee7944 Жыл бұрын

    In java it is also same...

  • @littlepepper7271
    @littlepepper7271 Жыл бұрын

    I’m still a little confused why does it equal 0 instead of two since it comes first in this case?

  • @chinjoka7418

    @chinjoka7418

    Жыл бұрын

    XOR operator works bite operation. 1xor1 and 0xor0 means 0 1xor0 and 0xor1 means 1 So both 2^2 bitewise 10^10 = 00

  • @ryansunil4856
    @ryansunil4856 Жыл бұрын

    I knew it wasn’t exponent but i didn’t know what ^ did so half way ig? 😅

  • @crazytiger6
    @crazytiger6 Жыл бұрын

    Looked at that, but I know that to get an exponent in python its ** not ^

  • @MEnUequals2
    @MEnUequals2 Жыл бұрын

    but why is it like this ? why do I have to remember myself each time I get this "error" that I have to change ^ to **

  • @sustrackpointus8613

    @sustrackpointus8613

    Жыл бұрын

    In most languages ^ is already used as xor, so actually u dont need to remember this specifically, it would be more confusing if they replaced ^ (xor) with any other operator

  • @harpleblues
    @harpleblues Жыл бұрын

    Who taught you it was zor? It’s x-or.

  • @lebgen
    @lebgen Жыл бұрын

    Thank God I use JS

  • @Kahooni
    @Kahooni4 ай бұрын

    import math math.pow

  • @Niculwmusic
    @Niculwmusic Жыл бұрын

    Its called exclusive or, thus pronounced ex-or. Not zor

  • @MikaelSilva-bi5bi
    @MikaelSilva-bi5bi Жыл бұрын

    alguem traduz ai pfv

  • @jason13gaming
    @jason13gaming Жыл бұрын

    **

  • @GamerDevIND
    @GamerDevINDАй бұрын

    I said error 😢

  • @sciencemathematics
    @sciencemathematics11 ай бұрын

    D

  • @apesander
    @apesander Жыл бұрын

    In c# its ^^ instead of ^

  • @tomchapman128

    @tomchapman128

    Жыл бұрын

    I'm pretty sure its still ^

  • @LambdaCreates
    @LambdaCreates Жыл бұрын

    "if you're like me" oh, so you didn't get it at the first try. i did.

  • @TheOtherSteel
    @TheOtherSteel Жыл бұрын

    Obviously I don't know Python well. The ^ character should be for raising to a power, not XOR.

  • @tildejustin

    @tildejustin

    Жыл бұрын

    **

  • @Ali-oo4wi

    @Ali-oo4wi

    Жыл бұрын

    you are not right my friend, here how we do it... 3**2 = 9 ( 3 power of 2 = 9 )

  • @johnleuenhagen9068

    @johnleuenhagen9068

    Жыл бұрын

    ^ is xor in almost every programming language.

  • @savado
    @savado Жыл бұрын

    I think the answer is D

  • @astatat8972
    @astatat8972 Жыл бұрын

    ez

  • @zbdfhg
    @zbdfhg Жыл бұрын

    zore

  • @verfxgbar8770
    @verfxgbar8770 Жыл бұрын

    Why does this Operator exist i dont understand

  • @vanjagrigoriev1442
    @vanjagrigoriev1442 Жыл бұрын

    I am appalled by your pronounciation of xor

  • @ggbandit500
    @ggbandit500 Жыл бұрын

    What?

  • @mzakyr342
    @mzakyr342 Жыл бұрын

    Why c code always return 0?

  • @sirmonke8946

    @sirmonke8946

    Жыл бұрын

    Back when C was created, I'm pretty errors were not handled by error messages, but instead by returning numbers that will be displayed. A return of 0 means that the program ran successfully. I don't think you are required to return 0 though, at least not anymore, but it is still the convention. Correct me if I'm wrong.

  • @ownedbyptr

    @ownedbyptr

    10 ай бұрын

    mov eax, 0 int 0x80 ; if u won't set exit code in assembly, ;it will segfault

  • @michaeltheisen
    @michaeltheisen Жыл бұрын

    Is this why none of my code has worked for the last 10 years??????????? What the hell is exponent then!?

  • @rz2374

    @rz2374

    Жыл бұрын

    exponents are **

  • @nczioox1116
    @nczioox1116 Жыл бұрын

    Gotta do (x-1)**2

  • @ken6349
    @ken6349 Жыл бұрын

    but is this knowledge any useful tho

  • @nahiarabeer9565
    @nahiarabeer9565 Жыл бұрын

    its 0 thanks to zor(XOR)

  • @konradwerner4134
    @konradwerner4134 Жыл бұрын

    **