Intermediate Python Tutorial #3 - Map() Function

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 56

  • @Haluna11
    @Haluna11 4 ปีที่แล้ว +23

    awesome, finally someone who can explain quickly and easily

  • @bryanttayou8128
    @bryanttayou8128 3 ปีที่แล้ว +5

    The map() explanation with the if statement is just so useful. Thx man

  • @konstantinosmaravegias4198
    @konstantinosmaravegias4198 4 ปีที่แล้ว +18

    thnx you,,, i was looking for something like this since the majority of videos are focucing in teaching the basics.

  • @shiraku3885
    @shiraku3885 3 ปีที่แล้ว +12

    I required this for competitive programming

  • @bepispoggoloco9765
    @bepispoggoloco9765 4 ปีที่แล้ว +2

    No one needs to tell you how good your channel is. The amount of dislikes you got on this video already shows everyone likes you. Good job buddy.

  • @adrianmh
    @adrianmh 3 ปีที่แล้ว +3

    Also the map function is magnitudes faster than the for loop. probably the more important reason to be using it instead of a loop

    • @kinanradaideh5479
      @kinanradaideh5479 3 ปีที่แล้ว

      is it faster than using list comprehension too?

    • @adrianmh
      @adrianmh 3 ปีที่แล้ว +1

      For the example I used yes, slightly faster. But your mileage may vary. Best to try it yourself

  • @tjravend
    @tjravend 2 ปีที่แล้ว

    loving this series!

  • @tomershechner
    @tomershechner 6 ปีที่แล้ว +20

    Great video and explanation! it's really sad for me that your channel is so small. your content is good and the upload rate is high!

  • @revanmardagh
    @revanmardagh 3 ปีที่แล้ว

    i like your method of teaching

  • @janiup_to_date6507
    @janiup_to_date6507 ปีที่แล้ว

    thanks sir
    the way i want to learn

  • @mono_onamoto
    @mono_onamoto 3 ปีที่แล้ว

    Thanks Tim

  • @Skaxarrat
    @Skaxarrat 6 ปีที่แล้ว +7

    Which one runs faster? List comprehension or map function?

    • @Shahzaib786ik
      @Shahzaib786ik 5 ปีที่แล้ว +16

      statement: [x**x for x in range(0,100)]
      time taken: 45.45980668100037 seconds
      statement:
      Before running timer
      def func(x):
      ... return x**x
      li = [x for x in range(0,100)]
      The statement below was measured
      list(map(func, li))
      time taken: 50.2515873479997
      Conclusion: List Comprehension is fast

    • @goodperson7427
      @goodperson7427 4 ปีที่แล้ว +2

      @@Shahzaib786ik Thanks for the info man.

    • @adrianmh
      @adrianmh 3 ปีที่แล้ว +1

      @@Shahzaib786ik wtf that doesnt take 45 seconds to execute. What are you running this on? Your calculator?

    • @adrianmh
      @adrianmh 3 ปีที่แล้ว +2

      Map function: Wall time: 4.29 µs
      List comprehension: Wall time: 6.91 µs

    • @Shahzaib786ik
      @Shahzaib786ik 3 ปีที่แล้ว

      @@adrianmh i put the number wrong. I used big value. sorry

  • @QuantumVortex17
    @QuantumVortex17 2 ปีที่แล้ว

    if you want for exampe to grab the element that are a string from an array I think it is better to use the filter function
    because it returns the array with the elements that are a string BUT with the map function it returns an array with true and false only

  • @breathmadrid9823
    @breathmadrid9823 2 ปีที่แล้ว

    Great tim

  • @carrot5040
    @carrot5040 4 ปีที่แล้ว +1

    Thanks for this amazing video...

  • @Shahzaib786ik
    @Shahzaib786ik 5 ปีที่แล้ว +7

    Your Channel is Great!
    Good explanations skills!
    You deserve an audience.
    Have you optimized your content for youtube search?

  • @charly7842
    @charly7842 2 ปีที่แล้ว +1

    Great short explanation. One thing, when you say map takes in two parameters, function and a list, do you mean only a list and not any other iterables such as tuples, sets, generators, etc. ?

    • @keitumetsemolefe3515
      @keitumetsemolefe3515 2 ปีที่แล้ว

      From my understanding it takes a function and an iterable

  • @Kennsenn5
    @Kennsenn5 2 ปีที่แล้ว

    another banger

  • @domillima
    @domillima ปีที่แล้ว

    It seems that the map function can't be used on numpy arrays, right?

  • @tedesca89
    @tedesca89 4 ปีที่แล้ว +1

    hey! thank you for the videos!!! I am also going through corresponding notes on your site and have a question. " numList.append(f1(nums))" should't it be " newList.append(f1(item))" otherwise it doesn't work

  • @freedempire
    @freedempire 4 ปีที่แล้ว

    seems that using list comprehensions will be simpler if u want to get a list

  • @joeywen4452
    @joeywen4452 3 ปีที่แล้ว

    Question: Shadows name 'x' from outer scope

  • @wongkingshun
    @wongkingshun ปีที่แล้ว

    print(list(map(func.li)))
    Does it means new list = the expression of the func2

  • @יעלליפשיץ-כ2נ
    @יעלליפשיץ-כ2נ 3 ปีที่แล้ว

    thank you!

  • @eshwar1085
    @eshwar1085 4 ปีที่แล้ว

    i have a doubt when i use list word in map function in jupyter notebook output is coming that list is not capable. is there any reason for it?

  • @MostfaL9999
    @MostfaL9999 3 ปีที่แล้ว

    does it work with ndarrays ?

  • @sangeetavishwakarma5106
    @sangeetavishwakarma5106 4 ปีที่แล้ว

    How could there be only 8 comments......
    R there only 8 intermidiate programmers in the world...
    :O

  • @anandib5401
    @anandib5401 3 ปีที่แล้ว +1

    Python 2 in 2018??

  • @ezraakran7158
    @ezraakran7158 3 ปีที่แล้ว +1

    How did 3 become 27 when it was applied to the function? 2:52

    • @ezraakran7158
      @ezraakran7158 3 ปีที่แล้ว +1

      actually ignore this LOL, silly question

    • @ethanmallard5942
      @ethanmallard5942 3 ปีที่แล้ว +1

      🤡

    • @ezraakran7158
      @ezraakran7158 3 ปีที่แล้ว +1

      @@ethanmallard5942 happens to the best of us

  • @pindiboy675
    @pindiboy675 2 ปีที่แล้ว

    func2 in func(x) is not working

  • @infinitespace1982
    @infinitespace1982 2 ปีที่แล้ว

    1:48
    Why does it say 'L' in the last item of the new list

    • @teamkiller2169
      @teamkiller2169 2 ปีที่แล้ว

      to show that the integer is "Large"

  • @urjitchakraborty5813
    @urjitchakraborty5813 4 ปีที่แล้ว +1

    li = [x**x for x in range(1,11)]
    print(li) also works

    • @4TH4RV
      @4TH4RV 4 ปีที่แล้ว

      is this called list comprehension?

    • @phungdaoxuan99
      @phungdaoxuan99 4 ปีที่แล้ว +1

      @@4TH4RV yes that's it

  • @Sciencedoneright
    @Sciencedoneright 3 ปีที่แล้ว

    So you mean every single thing is possible in python?

  • @problemsolver3254
    @problemsolver3254 ปีที่แล้ว

    literally vaush

  • @jessemaher9552
    @jessemaher9552 ปีที่แล้ว

    class

  • @antonisnic7510
    @antonisnic7510 2 ปีที่แล้ว

    Not Activated Windows is a big red flag, but I watched your tutorial regardless

  • @mr1enrollment
    @mr1enrollment 4 ปีที่แล้ว +3

    It has been two or more years since you made this video, so you may not be reading this anymore - but:
    I suggest that you find a small set of viewers to act as 'reviewer/editors' of your videos prior to release. Your content is good but then there is some glossing over and omission. For instance: in this video near the end you briefly mention the func2 idea. Now I think I get the reasoning - but you did not complete the example. The omission will leave some with a ?huh? stuck in the head.

  • @hackercop
    @hackercop 3 ปีที่แล้ว

    Activate windows!