Map, Filter, and Reduce Functions || Python Tutorial || Learn Python Programming

Sdílet
Vložit
  • čas přidán 17. 09. 2017
  • 𝙎𝙩𝙖𝙮 𝙞𝙣 𝙩𝙝𝙚 𝙡𝙤𝙤𝙥 𝙄𝙉𝙁𝙄𝙉𝙄𝙏𝙀𝙇𝙔: snu.socratica.com/python The map, filter, and reduce functions simplify the job of working with lists. In this lesson, we show you how to use each function. If you also use lambda expressions, you can accomplish a great deal in a single line of code!
    This video was made possible with the help of our Patrons on Patreon! We would especially like to recognize the generosity of our VIP Patron, Carlos A. We are so happy you are on the Socratica Team, Carlos!
    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)
    ♦♦♦♦♦♦♦♦♦♦

Komentáře • 574

  • @Socratica
    @Socratica  Před 2 lety +7

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

  • @kailashprasad1137
    @kailashprasad1137 Před 6 lety +1262

    Python should be a comedian because it is full of one liners.

    • @abbysands9510
      @abbysands9510 Před 6 lety +2

      lol

    • @Chiramisudo
      @Chiramisudo Před 6 lety +22

      A Map, a Filter, and a Reduce walk into a compiler... >.< Ugh! Obviously I should NOT be a comedian, lol.

    • @practicecomputing8506
      @practicecomputing8506 Před 5 lety +18

      1:40 "If brevity is the soul of wit, then python is in a class by itself"

    • @JoeWong81
      @JoeWong81 Před 5 lety +24

      The language itself was named after monty python

    • @salyoshkin
      @salyoshkin Před 5 lety +4

      Still too long. What in python you write in 1 line, in R you do in couple of symbols

  • @Socratica
    @Socratica  Před 4 lety +122

    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!! 💜🦉

  • @rweaver6
    @rweaver6 Před 6 lety +371

    Wonderful stuff. Sharp, professional and lively. The humorous delivery takes the edge off. At the same time, the presentation is carefully scripted to teach clearly and efficiently. No hesitations, no mistakes, no confusion. Just fast and pleasant learning. The code animation is easy on the eyes and so is she!

    • @alejorabirog1679
      @alejorabirog1679 Před 5 lety +6

      It's a master piece.

    • @Sra4825
      @Sra4825 Před 5 lety +45

      a masterpiece of a comment. clear and precise points. a subtle hint of hitting on the instructor.

    • @TheMangz1611
      @TheMangz1611 Před 5 lety +6

      @@Sra4825 she is worth it!

    • @kizzavincent
      @kizzavincent Před 3 lety +1

      You must be the best communicator of all time! Thanks.

  • @Terniedintorni
    @Terniedintorni Před 5 lety +42

    I am currently attending a university master in data science. These videos are 100 times Better than the slides I got from my professor. Clear and Easy to apply. Thank you

  • @rojanshrestha822
    @rojanshrestha822 Před 4 lety +32

    if brevity is the soul of wit, then python is in a class by itself !! Wow

  • @myroncarvalho4872
    @myroncarvalho4872 Před 5 lety +19

    Moment I heard the last line. Paused. Liked. Subscribed. Turned on notification. Too good.

  • @hmak5423
    @hmak5423 Před 4 lety +2

    At this very moment, you are the most engaging python teacher on CZcams. Goes down mainly to the tone and style/theme and covering so much in one small video.

  • @ARJUN-op2dh
    @ARJUN-op2dh Před 6 lety +53

    I generally don't comment but I am really amazed by this awesome video is. One word Awesome.... !! loved the way the concept was taught and delivered...

  • @juanmosca
    @juanmosca Před 6 lety +163

    list comprehension is also a good option instead of map function:
    areas_lst = [ area(r) for r in radii ]
    also for filter:
    filtered_lst = [ d for d in data if d > avg ]

    • @xekis
      @xekis Před 5 lety +18

      I was also going to comment that these functions are mostly deprecated because of list comprehension and generator expressions.

    • @normalmighty
      @normalmighty Před 5 lety +17

      I was about to point out the same thing. You can much more cleanly combine both with an expresion like
      filtered_areas_list = [area(r) for r in radii if r > minimum ]
      and for the efficiency of an iterator, just swap the [] with () to make it a generator comprehension
      filtered_areas_iter =(area(r) for r in radii if r > minimum )
      list and generator comprehensions are also far more intuitive for anyone who encounters them in the wild without knowing about them beforehand

    • @obinator9065
      @obinator9065 Před 5 lety

      More readable!

    • @balavarikuti
      @balavarikuti Před 4 lety

      And faster than map filter and reduce.

    • @Kachelator
      @Kachelator Před 4 lety

      same here

  • @eppotamus5255
    @eppotamus5255 Před 6 lety +12

    I have never seen tutorials this amazing. Its like I traveled back in time 30-40 years when people still made sense - could think and communicate. I enjoyed these so much. Thank you for all the hard work and long hours you guys put into this series. You are hands down the best! Can't wait to see the next one.

  • @instant_mint
    @instant_mint Před 6 lety +82

    I can't stop thinking of GLaDOS while listening to this.

  • @stevejohnson1685
    @stevejohnson1685 Před 6 lety +6

    From a Haskell programmer: Great introduction! In addition, script provides a nice, subtle sense of humor. Ms. Castro has superb enunciation.

  • @Socratica
    @Socratica  Před 4 lety +30

    Welcome to Socratica! You can see our entire Python Playlist here: bit.ly/PythonSocratica
    Subscribe to see all our new videos! bit.ly/SocraticaSubscribe

  • @doviche
    @doviche Před 4 lety +1

    Just started studying python a month ago, after almost 20 years of java programming language and I've just fallen in love with it.
    Great programming language.
    Very cool and attractive presentations Socratica.

  • @pranjal86able
    @pranjal86able Před 6 lety +462

    Loving the hate for Fahrenheit :) "How could this happen"

    • @jcxmej
      @jcxmej Před 6 lety +1

      pranjal86able We do not know. 😂

    • @Psycho4Ever666
      @Psycho4Ever666 Před 6 lety +19

      Like my first Professor in electrical engineering, she always told us to keep to keep it clean and metric ^^

    • @aaronmaturanacandelas2370
      @aaronmaturanacandelas2370 Před 6 lety

      I was looking for this comment.

    • @divusiulius7539
      @divusiulius7539 Před 6 lety +2

      That's why your Elect Engineering teacher likes Peter the Meter Man!

    • @CuongNguyen-le5ic
      @CuongNguyen-le5ic Před 6 lety +8

      Sigh, I wish US would use metric system, make life so much easier.

  • @jeffbarrett3344
    @jeffbarrett3344 Před 4 lety

    Extremely well done series. The best way to learn in my opinion. Short, to the point, engaging, code examples and awesome jokes. Using a one-liner one-liner joke... beautiful!

  • @kennymccormic7578
    @kennymccormic7578 Před 5 lety +3

    This is by far the most clear explanation of filter/map/reduce! Thank you very much!

  • @019KADESH
    @019KADESH Před 4 lety +4

    You are in a class by yourself Socratica! The way you teach is simply superb!

  • @jeffm6651
    @jeffm6651 Před 5 lety +2

    This is by far the best explanation of map, filter & reduce in Python ever.

  • @Socratica
    @Socratica  Před 4 lety

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

  • @cruepprich
    @cruepprich Před 5 lety +2

    Best map,filter,reduce explanation i've seen for any language! Thx!

  • @robinccc
    @robinccc Před 4 lety +1

    Didnt ever know that tutorials could be made this engaging. Brilliant.

  • @user-bm8uc1ei5p
    @user-bm8uc1ei5p Před rokem

    What a beauty... Programming languages always surprise me with its deep. Thank you for clear explanation!

  • @henryyao4860
    @henryyao4860 Před 4 lety

    This is the most entertaining python tutorial I have seen lol, but at the same time, I got what I need. Thank you!

  • @user-wc1sm8cj8s
    @user-wc1sm8cj8s Před 3 lety

    This is the only tutorial I've seen so far with this quality of editing, like, WHOAH!!!!

  • @guilhermehx7159
    @guilhermehx7159 Před 5 lety +2

    These Python tutorials of Socratica are simply the best!!! 👏🏻👏🏻👏🏻

  • @faisalee
    @faisalee Před rokem

    I am addicted to your channel. Such wonderful delivery and the humour is priceless 😊

  • @GEScott71
    @GEScott71 Před 5 lety

    Wow I'm loving Python and Socratica more and more with each video - thanks Socratica!

  • @avinash1904931
    @avinash1904931 Před 5 lety

    Awesome. I was learning at Coursera applied data science with python. And had doubts in maps and lambda. Came across your video. Very creative and also very nice explanation with real life example. Excellent. Please make more playlists. Thank you so much

  • @DUANEYAISER
    @DUANEYAISER Před 6 lety

    Thank you for another great lesson! I've been using mapping lately and I love the way you explain it.

  • @AjaySharma-pg9cp
    @AjaySharma-pg9cp Před 2 lety +1

    Till now I haven't seen a video being posted like this, great with differences that making this playlist and channel different from others, keep it up

    • @Socratica
      @Socratica  Před 2 lety

      Thank you for your kind and encouraging message!! 💜🦉

  • @pdubocho
    @pdubocho Před 6 lety +6

    "How could this happen? I do not know"
    Easily my favorite video.

  • @hashroot391
    @hashroot391 Před 6 lety +4

    First video I've ever watched on this channel. Kinda spooky but very engaging.

  • @Socratica
    @Socratica  Před 4 lety +4

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

  • @Sjutturaah
    @Sjutturaah Před 4 lety

    Ok. You just got a sub. These are hilarious while at the same time quite informational and compact. Well done.

  • @kdub1242
    @kdub1242 Před 4 lety +1

    This stuff is great. Before going for the heavy artillery, it's also useful to first consider list/dict comprehensions, but map,filter,reduce are great tools for the toolbox.

  • @MrAlhanz
    @MrAlhanz Před rokem +1

    You deserve much more attention! Those video are clear, interesting and have a great knowledge transfer.

  • @raphasage
    @raphasage Před 2 lety

    A keen sence of dread lurking around you... ...must complete the class, for your own survival!
    Love the approach! Inta Sub!

  • @poyrazaktas6374
    @poyrazaktas6374 Před 3 lety

    I've just explored this channel and I loved it!

  • @jakobfredriksson2272
    @jakobfredriksson2272 Před 3 lety

    Wow... Yesterday I found this channel and I can honestly write I've had difficulties with map, filter and reduce; especially knowing when to use them. EVERYTHING fell in place with this short video... amazing.

    • @Socratica
      @Socratica  Před 3 lety +1

      This was so great to hear - thank you for telling us! It really helps us get motivated to make more videos! 💜🦉

    • @jakobfredriksson2272
      @jakobfredriksson2272 Před 3 lety

      @@Socratica You are so welcome! I've watched some more videos this evening and you're making all subjects crystal clear in a very unique way. Keep up the good work! :)

  • @PerpetuaICreativity
    @PerpetuaICreativity Před 3 lety

    This is a python masterclass...even the jokes are efficient. great job and more please!

  • @stanislavhrytsyshyn1732
    @stanislavhrytsyshyn1732 Před 5 lety +3

    Watching ur videos brings a lot of pleasure and understanding of some moments, thx for ur work!

  • @ishanktyagi3220
    @ishanktyagi3220 Před 4 lety

    Thats amazing fully qualitative stuff with both professional and some humor thanks for the content

  • @indrajitbagchi7313
    @indrajitbagchi7313 Před 6 lety

    these are seriously underrated videos......one of the best python tutorials......very nice

  • @ahmedscrazymixacm1167
    @ahmedscrazymixacm1167 Před 3 lety +4

    You are great finally, someone teaches python with enthusiasm, instead of the sleepy attitude , BTW i really like the themes you use Great job

  • @emahbright8607
    @emahbright8607 Před 4 lety +8

    this is the funniest python tutorial i've heard in a while....

  • @jimparsons6803
    @jimparsons6803 Před rokem

    Liked the clip. 'Friend Face.' Instructive as always with useful and practical information and approaches.

  • @DaKLang
    @DaKLang Před 5 lety +1

    Ok, that joke at the end had me laughing in public. Nice breakdown of those function, BTW.

  • @whatyearisit9756
    @whatyearisit9756 Před 5 lety +17

    Why is Socratica so underrated. Why, oh why!?

  • @austinp.b6625
    @austinp.b6625 Před 6 lety +172

    hahaha this is good tutorial !!! Sounds like CIA briefing :P

  • @jakeambrose4294
    @jakeambrose4294 Před 2 lety

    Your course is awesome! Thank you. Im going through sololearns python courses and for each section, whatever the subject is, i come to your vids for further thorough explanation of whats being taught. I Appreciate your efforts more than words can express.

  • @kaushilkundalia2197
    @kaushilkundalia2197 Před 5 lety

    The most unique python tutorial ever !! Loved it and the content is also very good ! Thanks :D !

  • @pruthvip8137
    @pruthvip8137 Před 3 lety

    A unique style of python concept explanation , very different from other python learning CZcams videos . Nice :)

  • @lost-prototype
    @lost-prototype Před rokem

    I love the Command and Conquer / Westwood Studios vibe of these videos. I love post apocalyptic learning.

  • @Tweston3ny
    @Tweston3ny Před 2 lety

    Fantastic, per usual. Thank you. Awesome presentations with flawless, logical, and efficient, instruction and code.

  • @daslolo
    @daslolo Před 5 lety +7

    "Python should be a comedian because it's full of one liners" - subscribed

  • @Leonardo-jv1ls
    @Leonardo-jv1ls Před 5 lety

    I loved the explanation. Thank you. But if is was there in person watching, i would NEVER, raise my hand if had some doubt. This woman talking give me chills.

  • @PunmasterSTP
    @PunmasterSTP Před 3 lety

    Another phenomenal Python video from Socratica. This one was particularly...filter-ific!

  • @a7madx7
    @a7madx7 Před 3 lety

    I kinda like your approach very much, must've been so much effort put in this.

  • @nikhilkash92
    @nikhilkash92 Před 3 lety

    Your presentation is just out of this world.

  • @Jenko022
    @Jenko022 Před 6 lety +3

    I have been practising Python three for a while now but what I would really like to see is some videos on project ideas or scenarios to build on using Python. This would be great from practice and learning.

  • @natalieastafeva4885
    @natalieastafeva4885 Před 3 lety

    You made python sound like a detective story,very entertaining and useful!

  • @bicycleninja1685
    @bicycleninja1685 Před 5 lety

    Awesome. The reduce example also works with text. ",".join(mylist) is commonly used, but reduce gives you more flexibility and in my opinion is more elegant, especially if you're combining multiple operations/functions.

  • @aykutdizdar
    @aykutdizdar Před 5 lety +2

    I very much love the correct plural usage form of radius :)

  • @akira_asahi
    @akira_asahi Před 2 lety

    Thank you for the video. I am grateful for your time and contribution. Kind regards, Akira.

  • @gerardgauthier4876
    @gerardgauthier4876 Před 4 lety

    Wow! I can't believe you are dis'ing the reduce function. The reduce function is the general form for more specific functional ideas.. A solid understanding of reduce is essential for any modern programmer.

    • @asero82.
      @asero82. Před 4 lety

      > Beautiful is better than ugly [...]
      python -c 'import this'

  • @MK-lh3xd
    @MK-lh3xd Před rokem

    Socratica team is a unique blend of technology, teaching, wit and dialog delivery.

    • @Socratica
      @Socratica  Před rokem

      These are a few of our favourite things!! 💜🦉

  • @aghoorchian
    @aghoorchian Před 3 lety

    Captivating while teaching me what I needed to learn. Finally I know I'm gonna master Python soon!

  • @mixbaal0
    @mixbaal0 Před 4 lety

    Excelent video! I like the style and the presentation character too. And a tasty last line python joke. Congratulations. It would had been gorgeous to have a teacher like her in my college years. Hahahaha!!!

  • @MyLinuxToyBox
    @MyLinuxToyBox Před 5 lety +2

    I love the voice and speaking rhythm. Very informative videos.

  • @mrmuranga
    @mrmuranga Před 6 lety

    Well summarized and easy to follow along in a clever,humorous way...please make more videos..

  • @samuelfrank9947
    @samuelfrank9947 Před 4 lety

    Nice innovative idea than other tutorials to explain.... Loved it

  • @ivandrofly
    @ivandrofly Před 5 lety

    3:09 - "Do not forgot your jacket if you are visiting Argentina" ahaha that was gold!

  • @jasonavina8135
    @jasonavina8135 Před rokem

    These videos are evidence that anything can be explained in a clear, concise and easy to understand way. It really shows how silly knowledge gatekeeping is at the university and institutional level.

  • @humanrightsadvocate
    @humanrightsadvocate Před rokem

    It took me 12 years to find this channel. The algorithm never recommended me this channel. I stumbled upon this channel by entering, filter map lazy, in the search bar. Because... I was doing some exercises with map() and filter() and noticed the following code had unexpected results:
    num_list_4 = [2, 3, 6, 8, 9, 12, 15, 17]
    threevens = filter(lambda x : not x%3, num_list_4)
    sqrs = map(lambda x : x*x, threevens)
    print(num_list_4)
    #print(list(threevens))
    print(list(sqrs))
    The commented out line causes the sqrs list to be empty. And that's why I'm here.

  • @nkoroieric
    @nkoroieric Před 6 lety

    your illustrations always hit the nail on the head.

  • @quazichimp
    @quazichimp Před 6 lety +4

    wonderfully presented as always!

  • @sandeepnalvaya7612
    @sandeepnalvaya7612 Před 3 lety

    After watching this, I want to buy a projector first, and tune in on this channel from video 1. Great work👍

  • @pavankumarreddytadi7104

    Those graphics I would say are amazing. Subscribed in the first one minute.

  • @gustavomaganalopez6427

    This is beautiful! Thanks Socrática!

  • @greyhnd001
    @greyhnd001 Před 4 lety

    Awesome scripts. I am seeing this usefull for converting ips to binary and build a subnet calculator to confirm our firewall configurations are correct. Thank you so much for the work you've done on this.

  • @awisecar9540
    @awisecar9540 Před 2 měsíci

    Love the Halo/Matrix-esque aesthetic of this channel 🖤

  • @DevinderKumar
    @DevinderKumar Před 3 lety

    Very crisp, clear and efficient !

  • @rohitchakravarthi94
    @rohitchakravarthi94 Před 2 lety

    If brevity is the soul of wit then python is a class by itself.
    "Wow", this channel needs to be praised for its intellectual content.

  • @godwinmech
    @godwinmech Před 4 lety

    Wow... finally understood... thanks and subscribed

  • @leaoaugusto
    @leaoaugusto Před 2 lety

    "Python should be a comedian because it is full of one-liners." haha You got me there.!!

  • @ibrames3
    @ibrames3 Před 2 lety

    This video is amazing. I liked so much!!!

  • @PKR1503
    @PKR1503 Před 4 lety

    Your explanations are the best! Thanks for the help.

  • @xonxt
    @xonxt Před 4 lety

    I love this style :D
    Like I'm listening to a briefing in Command&Conquer, or something.

  • @patrykties
    @patrykties Před 5 lety +1

    w00t ....great way to teach ^^ I felt like in the game, environment my brain loves. Thanks again for a great tut

  • @austinp.b6625
    @austinp.b6625 Před 6 lety

    So reduce take two inputs at a time .. like the fibinocci and map just one input. Good one. Thanks a lot

  • @Schlumpfpirat
    @Schlumpfpirat Před 4 lety

    Interesting approach style-wise. I like it.

  • @slimyelow
    @slimyelow Před 5 lety

    another excellent concise python tutorial - loved it

  • @TheWyrdSmythe
    @TheWyrdSmythe Před 2 lety

    Python ain’t the only comedian on this channel! 😉 I do love map and filter, but after they took reduce away I found myself leaning more towards just using list comprehensions. I usually want a list anyway. I do agree with the philosophy of providing a single way to do something, and map and filter are extra viewed that way.

  • @mariuszwaszkuc5395
    @mariuszwaszkuc5395 Před 4 lety

    Good staff:) and it sounds like 'We are the Borg, you will be assimilated' - I like this;)

  • @bulentkamali
    @bulentkamali Před 5 lety

    Very charming and delightful narrative

  • @mohamed-abdelhay-desertcamel

    Amazing enough ...i liked the way u describe everything ..
    Thanks a lot lady ..
    And thanks for everyone who helped in that 💓❤💓

  • @omarcruz6326
    @omarcruz6326 Před 4 lety

    Hello Socratica, I have always enjoyed your Python Videos.
    Will you continue making all this great stuff ? 👌
    Greetings from Belgium.

  • @janaynalima100
    @janaynalima100 Před 5 lety

    An amazing introduction! Thank you!