List Comprehension || Python Tutorial || Learn Python Programming

𝙎𝙩𝙖𝙮 𝙞𝙣 𝙩𝙝𝙚 𝙡𝙤𝙤𝙥 𝙄𝙉𝙁𝙄𝙉𝙄𝙏𝙀𝙇𝙔: snu.socratica.com/python A list comprehension is a way to construct a list in Python using a single line of code. The pattern of creating an empty list, setting up a for loop, and then using several if-then clauses to determine which data should appear in the list can all be done in a single line in Python.
To learn Python, start our Python Playlist HERE:
bit.ly/PythonHelloWorld
Subscribe to Socratica: bit.ly/1ixuu9W
♦♦♦♦♦♦♦♦♦♦
We recommend:
Python Cookbook, Third edition from O’Reilly
amzn.to/2sCNYlZ
The Mythical Man Month - Essays on Software Engineering & Project Management
amzn.to/2tYdNeP
Shop Amazon Used Textbooks - Save up to 90%
amzn.to/2pllk4B
♦♦♦♦♦♦♦♦♦♦
Ways to support our channel:
► Join our Patreon : / socratica
► Make a one-time PayPal donation: www.paypal.me/socratica
► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
Thank you!
♦♦♦♦♦♦♦♦♦♦
Connect with us!
Facebook: / socraticastudios
Instagram: / socraticastudios
Twitter: / socratica
♦♦♦♦♦♦♦♦♦♦
Python instructor: Ulka Simone Mohanty (@ulkam on Twitter)
Written & Produced by Michael Harrison (@mlh496 on Twitter)
FX by Andriy Kostyuk
The dress worn by the instructor can be purchased at Shenova Fashion:
shenovafashion.com/collection...
♦♦♦♦♦♦♦♦♦♦

Пікірлер: 553

  • @Socratica
    @Socratica2 жыл бұрын

    Wear a Socratica Python shirt for good luck coding: shop.socratica.com/products/python-by-socratica

  • @borazan
    @borazan3 жыл бұрын

    "So please, append yourself to our list of subscribers" is pure gold...

  • @somtovitus

    @somtovitus

    2 жыл бұрын

    That was the point I liked the video

  • @Cmdrlucky8

    @Cmdrlucky8

    2 жыл бұрын

    @@somtovitus +1

  • @Zeddy27182

    @Zeddy27182

    Жыл бұрын

    likes += 1

  • @lil_uji_goated

    @lil_uji_goated

    7 ай бұрын

    @@Zeddy27182 likes++; is actually better

  • @pencilmein6646
    @pencilmein66466 жыл бұрын

    "Python cares about your sanity" love this xD

  • @SustainedFuture
    @SustainedFuture5 жыл бұрын

    For those of you playing along at home: If you're enjoying these tutorials as much as I am but dislike typing in long lists and tuples as much as I do, here are the data sets for your cut-and-paste pleasure. Extra typos provided free of charge. movies1 = ["Star Wars", "Gandhi", "Casablanca", "Shawshank Redemption", "Toy Story", "Gone With the Wind", "Citizen Kane", "It's a Wonderful Life", "The Wizard of Oz", "Gattaca", "Rear Window", "Ghost Busters", "To Kill a Mockingbird", "Good Will Hunting", "2001: A Space Odyssey", "Raiders of the Lost Ark", "Groundhog Day", "Close Encounters of the Third Kind"] movies2 = [("Citizen Kane", 1941), ("Spirited Away", 2001), ("It's a Wonderful Life", 1946), ("Gattica",1997), ("No Country for Old Men",2007), ("Rear Window",1954), ("The Lord of the Rings: The Fellowship of the Ring", 2001), ("Groundhog Day", 1993), ("Close Encounters of the Third Kind", 1977), ("The Royal Tenenbaums", 2001), ("The Aviator", 2004), ("Raiders of the Lost Ark", 1981)]

  • @passportbro904

    @passportbro904

    Жыл бұрын

    This comment is 4 years old and still gold. Thank you

  • @hrishikeshparab1236

    @hrishikeshparab1236

    Жыл бұрын

    Thanks man

  • @dubemnzegwu1340

    @dubemnzegwu1340

    Жыл бұрын

    Yeah , you’re definitely God sent…

  • @isaacbrewster1153

    @isaacbrewster1153

    5 ай бұрын

    You're the best. Seriously saved me 5 minutes of my life

  • @Socratica
    @Socratica4 жыл бұрын

    It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉

  • @tomtomski4454

    @tomtomski4454

    4 жыл бұрын

    I came over this video by chance and I am delighted by your ability to explain things as clearly as possible. Also I really appretiate great vocal. Thanks!

  • @robertlee6529

    @robertlee6529

    4 жыл бұрын

    Looking forward to it!

  • @anupsagar1990

    @anupsagar1990

    4 жыл бұрын

    4 months already, where is it🤷

  • @zackalcaina1896

    @zackalcaina1896

    3 жыл бұрын

    You guys/girls/...are soooo goood. I came across by coincidence and i was absolutely shocked by this Peculiar way to explain it. You nail it!

  • @Mady2207
    @Mady22077 жыл бұрын

    Seriously, you guys have changed the way to teach. Its like I'm watching python scifi movie. You guys are rocking. Thank you for complete team for marking these beautiful tutorials

  • @oguzhanatakan5793
    @oguzhanatakan57934 жыл бұрын

    "Python cares about your sanity", should be the motto of Python :D

  • @jhoniemusic

    @jhoniemusic

    3 жыл бұрын

    Hahahahaha this makes my day, but honestly.... Why not

  • @sircosm

    @sircosm

    3 жыл бұрын

    Actually, it doesn't compared to some of the other languages.

  • @zakiruzzama1822

    @zakiruzzama1822

    3 жыл бұрын

    Ugh I'm the 70th like. Should have left it at 69

  • @user-cd6vy2jg6f
    @user-cd6vy2jg6f7 жыл бұрын

    I absolutely cannot believe this channel exists. In-depth content presented so compellingly. Amazing

  • @Socratica

    @Socratica

    7 жыл бұрын

    That's so kind of you to say, thank you! We're so glad you're watching. :)

  • @latavish
    @latavish7 жыл бұрын

    OMG I just love the python series. I would pay cold hard cash for more in-depth computer science videos like this.

  • @Xardas_

    @Xardas_

    4 жыл бұрын

    likewise

  • @orion_222

    @orion_222

    4 жыл бұрын

    microwave ur cash b4 u give it to me

  • @papa515
    @papa5157 жыл бұрын

    One of the best 'list comprehension' explanations I've seen.

  • @TruSegone
    @TruSegone4 жыл бұрын

    "It's now TIME for Python to SHINE, and save TIME with a single LINE"

  • @sathvikmalgikar2842
    @sathvikmalgikar28422 жыл бұрын

    you are causing a revolution in the way people learn stuff.

  • @MoysésGurgel
    @MoysésGurgel7 жыл бұрын

    Hello, Socratica! I am a Python self-taught and you are being a precious help in this learning process. I have faced some difficulties and several times I was about to give up but when this is almost happening there is something that suddenly gives me the courage to move on. Now I have the fortune to discover your magnificent channel and so continue learning Python with your wonderful tutorial. I feel that this is what I needed to fulfill my dream of becoming a programmer one day. When that happens I will give the name Socratica to the first program that I will develop in your honor. Thank you, my friends!

  • @Socratica

    @Socratica

    7 жыл бұрын

    Thank you for this amazing comment. We are thrilled to play a small part in your journey! Stay the course, my friend.

  • @georgiosdoumas2446

    @georgiosdoumas2446

    4 жыл бұрын

    So after 3 years of typing this comment, have you become a professional developer?

  • @gauravnegi4312

    @gauravnegi4312

    4 жыл бұрын

    @@georgiosdoumas2446 I knew someone would ask this.

  • @realnice3672

    @realnice3672

    3 жыл бұрын

    @@gauravnegi4312 lol

  • @faresalouf

    @faresalouf

    3 жыл бұрын

    Everyone is self taught..

  • @evemarietou
    @evemarietou3 жыл бұрын

    I was having a difficult time understanding list comprehensions in the Udemy python course I'm taking, so I came here. This is my first time watching one of your videos, and it was sooo helpful. I particularly appreciated the use of an engaging, real-world example of list comprehensions involving tuples (i.e., movies from the year 2000). Quadruple points for the sci-fi aesthetic!

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

    reading about list comprehension seemed complex and difficult to understand but Socratica cleared this topic in minutes....wow thannk you!

  • @Socratica

    @Socratica

    Жыл бұрын

    This is so great to hear!! 💜🦉

  • @selinalkan1009
    @selinalkan10093 жыл бұрын

    I have been teaching myself Python over a popular website, but their exercises are very few, and I find it hard to come up with ideas to practice on my own at this stage. This short video has taught me much more than what I have tried to learn for hours on that website! Kudos to Socratica!

  • @n0block
    @n0block7 жыл бұрын

    The people making these videos are absolutely genius.

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

    I was struggling with this all day until I saw this. Needless to say I will be coming back for more tutorials. thank you!

  • @hayfordadjavor18
    @hayfordadjavor186 жыл бұрын

    Socratica has just revolutionized the learning experience; l'm indeed grateful to the team! You rock, Socratica!!

  • @benjaminauer8637
    @benjaminauer86374 жыл бұрын

    this is my favorite coding tutorial of all :) no trying to be an entertainer or showman, no blabbering about coworkers and their names and interests. straight facts. and a sexy voice that reminds me of spymovies :)

  • @hammerhead351
    @hammerhead3514 жыл бұрын

    I love these videos! The information is top shelf, and the humor is extra EXTRA dry!

  • @TheDuckofDoom.
    @TheDuckofDoom.6 жыл бұрын

    The double asterisk "**" is used for exponents because in general purpose programming the circumflex or caret "^" was already taken for "start of line" in file parsing, eg regex and for the bit-wise OR operator in C. Old languages didn't have any exp operator because it isn't/wasn't a primitive hardware operation in most CPUs thus exponentiation is provided via a libraries or custom functions. More semantically speaking in various syntax that use the circumflex or caret "^" such as LaTex or MathJacks it actually represents a shift to superscript not necessarily exponentiation (in turn superscript when used with a number is what formally means exponent, but superscript is also used for sigma style sum notation and integral notations.) In addition Python borrows heavily from C conventions and part of the advantage of Python is that it can interact with C more cleanly than many other languages. No need to reinvent the wheel or create mental syntax switching problems for the developer using both languages or simply using regex syntax.

  • @meguellatiyounes8659

    @meguellatiyounes8659

    6 жыл бұрын

    wolfedog99. It borrowed from Fortran

  • @TommyZommy

    @TommyZommy

    5 жыл бұрын

    Why oh why

  • @JohnCarrFitness

    @JohnCarrFitness

    3 жыл бұрын

    This is way beyond me ....

  • @boundto484
    @boundto4846 жыл бұрын

    Finding this series has made me realize that every other channel that teaches Python is doing it wrong. This series is incredible, and I would be more than willing to buy these videos.

  • @brianbreeden8864
    @brianbreeden88644 жыл бұрын

    I have been struggling with this topic for the last day or so. This video was very helpful in learning this concept, thank you for making it!

  • @berinchandar
    @berinchandar7 жыл бұрын

    Just watched one video in this series and that made me to complete the whole series in one shot. It would be better if u upload more videos without taking much time. Awesome work.

  • @singsai
    @singsai7 жыл бұрын

    I'm strictly Javascript these days, but I am so happy I stumbled on your videos tonight. You're hilarious and enlightening. I have appended my name to your subscriber list.

  • @kaug5570
    @kaug55705 жыл бұрын

    Probably the best Python tutorial series on KZread.

  • @rogerwilko3717
    @rogerwilko37174 жыл бұрын

    Finally a video that explained all the details I needed! Thank you!

  • @unibrow9384
    @unibrow93843 жыл бұрын

    Top notch video presentation and content. I absolutely love how your videos are able to hold my attention until the end.

  • @NikoxD93
    @NikoxD937 жыл бұрын

    I love using list comprehensions, so neat! :)

  • @Socratica
    @Socratica4 жыл бұрын

    Support what you love! Socratica has a Kickstarter to make more Python: bit.ly/PythonKickstarter

  • @whatsnewnow4469
    @whatsnewnow44694 жыл бұрын

    Best audio effect for the tutorials like this.awsome.

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

    this style is so cool...and sarcastically funny at the same time!😂😂 the examples and explanations themselves are amazing, thank you guys for creating such an interesting video tutorial !!

  • @jarvisnederlof35
    @jarvisnederlof356 жыл бұрын

    Excellent Videos, the story telling effect, the pauses, the content, everything.

  • @mohamednour4901
    @mohamednour49015 жыл бұрын

    One of best channels. This is a great video about list comprehensions. I love your content :) .

  • @hajayedamir1878
    @hajayedamir18786 жыл бұрын

    This is a great video about list comprehensions. Python is a neat language!

  • @nitramcontrario
    @nitramcontrario6 жыл бұрын

    When I discovered your channel I already knew how to program in Python, but either way I saw all of your videos, because they're amazing and also funny. Well done and please keep up with your Python section.

  • @Yasharvl
    @Yasharvl4 жыл бұрын

    Thank you, I`ve just deleted two whole functions and instead added three letters to my list comprehension! :D so happy about it!

  • @martekindustries69
    @martekindustries693 жыл бұрын

    I love these videos so much. Lots of information packed in small videos with out other unnecessary information. I want socraticas voice for my Google home too lol

  • @TheAshwebstar
    @TheAshwebstar5 жыл бұрын

    This is a phenomenal way of teaching and explaining things. I am in love with this channel :)

  • @ProfessorsChoice1
    @ProfessorsChoice14 жыл бұрын

    Here comes your new subscriber with list comprehension. Thank you, for such wonderful explanation.

  • @Jasoncalvo7
    @Jasoncalvo75 жыл бұрын

    I am really impressed by this tutorial. I have ADD and it kept my attention lol. Thnk you for making this and I will now be using socratica for my coding studies.

  • @killtomorrow123
    @killtomorrow1235 жыл бұрын

    Definitely helped me understand list comprehensions much better!

  • @alaeddinetmar5714
    @alaeddinetmar57144 жыл бұрын

    Because of this tutorial, I earned a lot of respect in my company, everyone says my code is beautiful! Thank you!

  • @luisfernandoyupanquitaco8630
    @luisfernandoyupanquitaco86305 жыл бұрын

    Complex topics in a single video!!! Great.

  • @Gtv7020
    @Gtv70204 жыл бұрын

    Woooow,i feel like i am watching my favorite movie and learning my favorite subject with my favorite teacher at a time! just wonderful. my Question is how on earth i didn't watch this till now?

  • @Javie188
    @Javie1884 жыл бұрын

    This is exactly what i was looking for. Thanks for the videos!

  • @pyroghost11
    @pyroghost116 жыл бұрын

    That was extremely informative, and the presentation just keeps it more interesting for good old scifi fans like myself 😊 gonna have to watch all your videos now

  • @lalitpatnaik7840
    @lalitpatnaik78405 жыл бұрын

    We need more of these videos... It'll be really helpful if you can introduce analytics concepts with python. Bless you people :)

  • @whozz
    @whozz7 жыл бұрын

    Amazing video! I liked the futuristic-robot voice style

  • @iggymach
    @iggymach3 жыл бұрын

    Love this teaching style Lol. 30 seconds in and I like the channel already.

  • @kwubegharitony2044
    @kwubegharitony20444 жыл бұрын

    i love this. I am learning python all alone. This video has removed confusion from my head.

  • @rupakale7688
    @rupakale76884 жыл бұрын

    when i watch your video i get next level of energy, thank you socratica for your wonderful video

  • @mindfulape8763
    @mindfulape87632 жыл бұрын

    Love your teaching methods and keeps me entertained and focused. Hard to do with topics like this but your channel makes it look easy :)

  • @muhammadtalhabaig4908
    @muhammadtalhabaig49085 жыл бұрын

    WOW! I just love this way of teaching!! You have got a new subscriber, Keep up the great work 😃

  • @NavedAhmadX
    @NavedAhmadX6 жыл бұрын

    One of best channels. Thanks for sharing the knowledge. Big Fan.

  • @AnkitSingh-xg4qy
    @AnkitSingh-xg4qy3 жыл бұрын

    This channel is a hidden gem, Since two days my productivity level is going higher n higher...

  • @vandyrock9746
    @vandyrock97466 жыл бұрын

    Awesome.Finally one best video I was looking for.

  • @andresyesidmorenovilla7888
    @andresyesidmorenovilla78883 жыл бұрын

    Incredibly well crafted video. Excellently explained. My congratulations, I didn't know your channel until now, but I'm really impressed, It's obvious you put a lot of thought an effort into your videos!

  • @nehajha5393
    @nehajha53934 жыл бұрын

    Teaching is an art and you possess this skill :)

  • @omtav9024
    @omtav90244 жыл бұрын

    Best video ever! It really teach how to save time while coding lists

  • @andreafranceschini2400
    @andreafranceschini24004 жыл бұрын

    Simply clear as water. Perfect.

  • @utkarshrajpurohit1554
    @utkarshrajpurohit15544 жыл бұрын

    "append to our list of subscribers" THAT WAS HILARIOUS XDDDDDDDDDDDDD

  • @geoffreyssebagala7790
    @geoffreyssebagala77904 жыл бұрын

    Thanks so much. i love the way you make complex python topics easy to understand

  • @manbig1544
    @manbig15447 жыл бұрын

    Please upload more videos as soon as possible.It seems that you update your video nearly every two month.Already subscribed.

  • @AwesomeFluffyBoobies
    @AwesomeFluffyBoobies3 жыл бұрын

    thanks for this video. just started learning python and was struggling with list comprehensions, but this helped me

  • @bevaraindumathi2685
    @bevaraindumathi26853 жыл бұрын

    The way you connect the concepts to real world, it's Simply Superb👌👌.

  • @meanmole3212
    @meanmole32126 жыл бұрын

    Wow, I was looking a good video on this topic and even when this video got recommended I decided to ignore it first solely based on its thumbnail. Maybe my subconscious prejudices and stereotypes kicked in and guided me to avoid it, but when I overcame them and gave this video a chance I did not find it only very well made and informative but very creative and cool as well! Subscribed!

  • @MrOzy8080
    @MrOzy80804 жыл бұрын

    Starting this video, it felt kind of gimmicky But I can't deny, this is an insanely good video with easy to understand and direct content Fantastic work!

  • @violet_broregarde
    @violet_broregarde2 жыл бұрын

    Thank you for explaining list comprehensions so clearly and simply. I thought they were pretentious when I didn't understand them, but now I see the value. Great video :D

  • @Socratica

    @Socratica

    2 жыл бұрын

    This was amazing to read, thank you for letting us know!! 💜🦉

  • @mr.crowley4099
    @mr.crowley40994 жыл бұрын

    Hahaha.. append yourself to our list of subscribers. Definitely subscribing.

  • @superzolosolo
    @superzolosolo5 жыл бұрын

    Thank you! You've helped me so much!

  • @exploringMyself998
    @exploringMyself9984 жыл бұрын

    loved the teaching style and the way of teaching is very easy to understand

  • @CarloRizzante
    @CarloRizzante7 жыл бұрын

    Wow, cool episode, really. I'm so jobless at the moment but as soon as I'll get some income, be sure Socratica will be one of the good channels I'll support on Patreon. Can't wait to be able to do so!

  • @bulentoral1177
    @bulentoral11773 жыл бұрын

    Your videos are awsome. FAST, CLEAR,UNDERSTANDABLE

  • @hackprepa964
    @hackprepa9647 жыл бұрын

    wooooooooooooooooow........This is amazing ..everything ....all of it .....i can t stop watching your videos....soo smart yet so simple ...Thank you

  • @vasfigumus7728
    @vasfigumus77287 жыл бұрын

    Keep them coming. This can't fail.

  • @Socratica
    @Socratica4 жыл бұрын

    We're halfway there. We still need your help! Support Socratica Python Kickstarter: bit.ly/PythonKickstarter

  • @GEScott71
    @GEScott715 жыл бұрын

    Very helpful, thank you for another great tutorial!

  • @diencai1812
    @diencai18125 жыл бұрын

    Very engaging and easy to understand. Love the persona

  • @ben-cb5er
    @ben-cb5er5 жыл бұрын

    subscribed and likeddddd!! omg please dont stop making python Tutorials ever!!! keep it up! i learn and you guys make it so much interesting lol thank you..

  • @psymon25
    @psymon254 жыл бұрын

    I personally think this style of teaching python is brilliant shame there is not more lately like this

  • @bckzilla
    @bckzilla7 жыл бұрын

    Absolutely awesome format!

  • @acp3012
    @acp30126 жыл бұрын

    i impressed by the example to demonstrate the subject. Awesome !

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

    Yo what is this gold the style is amazing!

  • @ApoorvaGarg0308
    @ApoorvaGarg03086 жыл бұрын

    You have made it very very interesting! Well done!

  • @brettvanderwerff6917
    @brettvanderwerff69176 жыл бұрын

    Python cares about your sanity!

  • @user-ip8he1cw1l
    @user-ip8he1cw1l6 ай бұрын

    I thought I was really getting the hang of python until I got to list comprehensions. This video really helped A LOT though. Thanks!

  • @withravii
    @withravii2 жыл бұрын

    Never understood List comprehension in a better way before this :) Thanks

  • @jaypratap3888
    @jaypratap38885 жыл бұрын

    your way of teaching is amazing . The video was a great help . keep on making such videos.

  • 4 жыл бұрын

    Thanks so much for these videos. They're really helpful.

  • @babakj7641
    @babakj76414 жыл бұрын

    Hey @Socratica at 3:18 (Quadratic Reciprocity), it must be len(set(p_remainders)) = (p+1)/2 since you would have repeated elements in the list if you don't use set to discard the repeated remainders. And thanks for the your awesome videos, you guys are doing a great job!

  • @alexandrepv
    @alexandrepv5 жыл бұрын

    A nested loop... in a single line of code. I'm in love :D

  • @AVertexFar2Near
    @AVertexFar2Near6 жыл бұрын

    Great material - like the format and communication style.

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

    It's purely amazing how beautifully it is explained. I just subscribed to this channel. Congrats for making such beautiful and informative content and thank you!!

  • @Socratica

    @Socratica

    Жыл бұрын

    We're so glad you've found us! Thank you for your kind words. 💜🦉

  • @trentRalston
    @trentRalston3 жыл бұрын

    Codecademy skimps on details in some of their lessons. You've covered what they missed! Thank you so much.

  • @Socratica

    @Socratica

    3 жыл бұрын

    This was great to hear - thanks for letting us know! 💜🦉

  • @yashagarwal3999
    @yashagarwal39994 жыл бұрын

    thank you thank you thank you thank you so much i was struggling to do the matrix binary exponentiation by pisano method and i needed exactly this video

  • @diogocorrearj
    @diogocorrearj7 жыл бұрын

    Congratulations! Amazing videos, keep going with this. Some Client-Server sockets programming videos would be a great topic (:

  • @anujlahoty8022
    @anujlahoty80225 жыл бұрын

    Always makes me learn and laugh at the same time... Awesome channel.

  • @megh219
    @megh2196 жыл бұрын

    Very intuitive and well explained