Please Master These 10 Python Functions…

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 151

  • @TechWithTim
    @TechWithTim  5 месяцев назад +14

    I have a free introduction course on how to land a developer job in 2024 here: techwithtim.net/dev

  • @johnbennett1465
    @johnbennett1465 5 месяцев назад +36

    Print also takes a file argument to write to a file.

  • @ameldancalippo6912
    @ameldancalippo6912 4 месяца назад +7

    Nice simple explanations that start you thinking of how you can use these functions. Exactly how you want to feel when learning a language.

  • @bayesian7404
    @bayesian7404 8 дней назад +1

    Excellent Tim This is the first time I watched one of your vids. I just subscribed

  • @christoph231090
    @christoph231090 5 месяцев назад +8

    These "basic" videos are very nice.
    Thanks for that one.

  • @mrdjangofreeman5560
    @mrdjangofreeman5560 Месяц назад +2

    Thx Tim, crystal clear, fast, accurate Vs. the purpose. Great job 😊

  • @DrsJacksonn
    @DrsJacksonn Месяц назад

    Seeing usages of the zip, enumerate and map functions in other people's code has definitely shown me their utility and I've been applying them myself ever since.

  • @MansiBansalc
    @MansiBansalc 5 месяцев назад +22

    For the first time ever i understood how lambda functions work. Thankyou so much Tim!!

    • @kuldeep7063
      @kuldeep7063 3 месяца назад

      For this problem you should refer a structured course...

    • @miiguliexe1787
      @miiguliexe1787 2 месяца назад

      @@kuldeep7063 should they? seems like this video was good enough for them

  • @softwareengineer8923
    @softwareengineer8923 5 месяцев назад +3

    Thanks a lot Tim, it was such a helpful recap for me. Keep up the high quality content.

  • @mukmusicdiary
    @mukmusicdiary 3 месяца назад +4

    Any chance you could make a video on how to properly study and retain programming? I find myself repeat myself with the same stuff because I can't memorize what I'm learning. It would be amazing to see how you studied and practised programming.

    • @odieshehabaldmary8880
      @odieshehabaldmary8880 2 месяца назад +1

      keep practice and write lot of scripts and you will memorize it without noticing . I learned this way

    • @Alex_Underwad
      @Alex_Underwad 2 месяца назад

      Understanding how the code is structured is more important than memorizing functions. Being skilled in web searching and utilizing forums such as stack overflow are probably more useful than memorizing. Every coder searches for definitions or asks forums when they get stuck.

    • @joeeeyyyyyy
      @joeeeyyyyyy 2 месяца назад

      Start projects and be relatively ambitious - more than you know how do to do but not massive projects. Think 'how do you do basic ____ work?' (Gui, classes, functions, structuring a app, docker, etc...)
      If you apply the knowledge you are much more likely to remeber. Good luck!

  • @RemyDelaCruz
    @RemyDelaCruz 5 месяцев назад +7

    Used some of these for a recent class, and this serves as a refresher! Great content.

  • @raghunathansundaresan
    @raghunathansundaresan 5 месяцев назад

    I've always been using key argument in sorted function by trial and error. Finally I understood. Thanks Tim great video as usual!

  • @johnbennett1465
    @johnbennett1465 5 месяцев назад +19

    Zip takes a strict argument when it is important that the lists are the same length. Without it zip can hide bugs in your list generation.

  • @johnbennett1465
    @johnbennett1465 5 месяцев назад +18

    Using enumerate(tasks, 1) makes the code even cleaner. The second parameter is the start value.

    • @Joeadamu
      @Joeadamu 5 месяцев назад

      This is true then what about the full stop after the number because you don't wanna be using a comma...

    • @johnbennett1465
      @johnbennett1465 5 месяцев назад +2

      @@Joeadamu all my change does is use enumeration values from 1 to N instead of 0 to N-1. You also remove the " + 1" from the print call. Everything else remains unchanged.
      In this case it is a small improvement. In more complicated cases it can make the code noticeable clearer and reduce the chances of off by one errors.

    • @Joeadamu
      @Joeadamu 5 месяцев назад +1

      @@johnbennett1465 Oh yeah... I get your point, thanks for the clarification :)

    • @fancypants6062
      @fancypants6062 4 месяца назад

      omg I can't believe I never knew about this. I use enumerate so much. Thank you.

    • @johnbennett1465
      @johnbennett1465 4 месяца назад

      @@fancypants6062 you're welcome.

  • @johnpeelslovechild
    @johnpeelslovechild 2 месяца назад +1

    5:00 There is a mistake. The range function will generate a range from zero.

  • @legojenn
    @legojenn 5 месяцев назад +21

    Thanks! I never understood lambda functions. I overcomplicated it.

    • @Chiramisudo
      @Chiramisudo 4 месяца назад

      They're just anonymous / unnamed functions. JavaScript, C#, and many other languages have the same concept.

  • @kaduflutist
    @kaduflutist Месяц назад +2

    Thank you a ton! You're simply The Best. You don't hide anything - it's just the way it is and works. I believe the world still stands a chance to be a better one when I see people sharing like you do.

  • @kapibara2440
    @kapibara2440 5 месяцев назад +3

    Thank you for the video Tim 😃

  • @jimalix6270
    @jimalix6270 5 месяцев назад +2

    Extremely helpful video! Thanks so much!

  • @videofountain
    @videofountain 2 месяца назад +1

    At time 04:57 the speaker says the range starts at [one]. Is that correct?

  • @souris_a_boule5695
    @souris_a_boule5695 5 месяцев назад +1

    For the sum function, there is a cool thing you can do with the start argument. You can put any type that support the + operator. So for example if you want to flatten a list of list you can pass it with start=[] and it will get the job done

    • @johnbennett1465
      @johnbennett1465 5 месяцев назад +1

      Interesting. I tried to use it to append strings and it doesn't work. Since the error message explicitly says to use join, it must be explicitly checking for.

    • @souris_a_boule5695
      @souris_a_boule5695 5 месяцев назад

      @@johnbennett1465 Ah that's weird I tried it with a list and it works so I assumed that it work with any object that support + operator. Guess I'm wrong

    • @souris_a_boule5695
      @souris_a_boule5695 5 месяцев назад

      After some research I found out that the sum function specificaly "ban" string for optimization reason and encourage you to use join instead. I don't know if other types are checked

    • @johnbennett1465
      @johnbennett1465 5 месяцев назад

      @@souris_a_boule5695 thanks for the information. I should have guessed this. I am aware of the performance issues.

  • @avvarutheja
    @avvarutheja 4 месяца назад

    What is the advantage of map and filter functions, the same can be achieved with single line list_comprehension aswell. Curious to know what are the added advantages of using these map & filter functions. My approach for the items discussed in the video are :
    strings = ["my", "world", "apple", "pear"]
    l_comp = [len(i) for i in strings]
    print(l_comp)
    l_append = [i + "s" for i in strings]
    print(l_append)
    l_filterd = [i for i in strings if len(i) >4]
    print(l_filterd)

  • @mosesmbadi
    @mosesmbadi 2 месяца назад

    Hi, awesome video. I have a quick question, what tool do you use to record your videos?

  • @dragonfly-7
    @dragonfly-7 4 месяца назад

    Hi Tim ! #10 @18:03. I didn't know that I'm able to both read to a file and write from a file ... You'll never stop learning ... 😉

  • @SchwarzschildM
    @SchwarzschildM 5 месяцев назад +1

    Any chance to have all of the functions within Jupiter notebook or code file for further usage?

  • @jayd_ee
    @jayd_ee 5 месяцев назад +1

    Thank you so much ❤️

  • @sun-prairie
    @sun-prairie 4 месяца назад

    thanks for the excellent intro to functions

  • @ExDarkx3
    @ExDarkx3 5 месяцев назад

    i always swap out map/filter for list/dict comprehensions just because of readability. I feel like the only time time ill ever use them is if im using a terribly large dataset and im facing memory issues with list comprehensions. Even so, im in devops so i rarely face that problem

  • @RoyZennet
    @RoyZennet 3 месяца назад

    Woah that append seems useful for me
    Sorry too newbie, just started to learn about 2 days ago

  • @SagangaKapaya
    @SagangaKapaya 3 месяца назад

    Thanks, this was very helpful to me.

  • @ralvarezb78
    @ralvarezb78 5 месяцев назад +1

    I often use lambda functions with filter and map

  • @rassy7
    @rassy7 5 месяцев назад +7

    Tim Overflow is sooooo much easier to understand than Stack Overflow.

    • @AllPraiseToYah
      @AllPraiseToYah 5 месяцев назад

      😂😂😂

    • @Chiramisudo
      @Chiramisudo 4 месяца назад

      So is Claude AI. I still prefer the human element though, and always will, but when you want a quick discrete answer, AIs are great at summarizing results from many websites. I actually found Leo (Brave's AI built into their search engine) to be excellent at this.

  • @htcsaj7876
    @htcsaj7876 5 месяцев назад +1

    Any advices or tutorial how to create python SaaS project

  • @SmokingNoir
    @SmokingNoir 3 месяца назад

    When I was working at NASA I used these all the time when working on the Space Shuttle Challenger

  • @jamesharrington233
    @jamesharrington233 4 месяца назад

    Very informative, thank you!

  • @martinkuliza
    @martinkuliza 3 месяца назад +1

    Re SUM
    why would you do this and type 2 lines of code....
    numbers = (1, 4, 5, 23, 2)
    print(sum(numbers))
    when you can do this and have 1 line of code
    print (1 + 4 + 5 + 23 + 2)
    and get the same result ?

    • @beyondthelimits788
      @beyondthelimits788 Месяц назад

      what if we want the users input, besides he's using it just as an example

    • @martinkuliza
      @martinkuliza Месяц назад

      @@beyondthelimits788
      I Understand.
      And.. I based my comment on his example.
      clearly we can take any basic thing in programming and say, but what if this and that and then we need to do this and call this and whatever.
      and then we have 15 lines
      I'm just asking why he didn't put it on 1 line

  • @alimihakeem841
    @alimihakeem841 5 месяцев назад

    Tim, Thanks so much. I do love your content. It's valuable

  • @andreyv116
    @andreyv116 3 месяца назад

    In which contexts are map and filter *not* deprecated versus their comprehension counterparts?

  • @Dr_Adar
    @Dr_Adar 5 месяцев назад

    Helped me a lot! thanks!

  • @Nicolas_Turpin
    @Nicolas_Turpin 3 месяца назад

    What about the "dir" function ? my favorite one :O

  • @KJHounchou
    @KJHounchou 5 месяцев назад

    Is your freecodecamp machine learning with python course still useful for beginners? if you have a better course, could you tell me? I'm trying to get into an apprenticeship of software engineering and I'm not sure if it's the right decision to spend time on a 4 years old course. Thank you.

  • @BboyGraphicx
    @BboyGraphicx 2 месяца назад

    Thank you so much

  • @bryce1361
    @bryce1361 3 месяца назад

    Print also as the ever helpful .format() and f strings

  • @101Mant
    @101Mant 5 месяцев назад

    I guess you need to know map and filter so you can replace them with comprehensions which you should be using instead.

  • @BreuerTimo
    @BreuerTimo 3 месяца назад

    Thanks for that one

  • @StrandgaardMorten
    @StrandgaardMorten 3 месяца назад

    Men der findes mere hensigtsmæssige og plausible metoder. Men tak for den detaljerede lektion, kolleger

  • @DavidParathyras
    @DavidParathyras 5 месяцев назад +1

    Master has been pleased 😁

  • @samuelvanhoolandt9725
    @samuelvanhoolandt9725 5 месяцев назад

    Thank you !

  • @markramsell454
    @markramsell454 5 месяцев назад

    Python does many things for you that I used to do explicitly.

  • @mipecz
    @mipecz 5 дней назад

    "You are as strong a programmer, as your fundamentals are strong"

  • @dataninjuh2135
    @dataninjuh2135 Месяц назад

    def fastforward():
    if Skip sponsor
    Get advert
    return advert

  • @SsengendoReymond
    @SsengendoReymond Месяц назад

    u are the best teacher although u so fast

  • @ninjapirate123
    @ninjapirate123 3 месяца назад

    Well all of this was simple to understand

  • @hadisardari1564
    @hadisardari1564 5 месяцев назад

    Dear Team,
    Thank you for your awesome content. I would like to request that you speak a little slower, if possible. For those of us whose native language is not English, your speaking speed can sometimes be a bit fast and unclear, causing us to miss some parts of the content.

  • @Superstar-nl5tl
    @Superstar-nl5tl 4 месяца назад +72

    Why are all the python tutorials explained lightning fast as if I am already a pro and know what it is talking about?

    • @zackzintho48
      @zackzintho48 4 месяца назад +27

      Maybe they're made for people already familiar with these things but don't know exactly how they work. This one is clearly not for absolute beginners who don't know what a function is.
      There are many more tutorials that assume you're an absolute beginner. Example is Harvard's CS50 Python tutorial...

    • @anuragtewary5314
      @anuragtewary5314 4 месяца назад

      This one is a good refresher of all the commonly used functions in python. I recommend watching this video after having atleast 6 months of experience in python. If you have written any python code for a project or LeetCode, then you will definitely have encountered and used these functions.

    • @Xboxman234
      @Xboxman234 4 месяца назад +1

      Why don’t you give some examples about things that he mentioned that he assumes you should already know? everything in here seemed fairly low level. Maybe if you provided some examples that I could tell you how you’re wrong

    • @tatert0tz123
      @tatert0tz123 4 месяца назад +4

      probably because you think you are a superstar already when you are just a star.

    • @Superstar-nl5tl
      @Superstar-nl5tl 4 месяца назад

      @tatert0tz123 haha maybe 🤔

  • @afraazahmedusmani
    @afraazahmedusmani 4 месяца назад

    I used the help function to create a python bot (not released)

  • @railuvvyou7096
    @railuvvyou7096 11 дней назад

    When he say "Please" on his video title begging for us to learn python

  • @kowshikk.6559
    @kowshikk.6559 3 месяца назад

    Why do they used curly braces while sum function

  • @dimox115x9
    @dimox115x9 5 месяцев назад +1

    Plz i need your need in one of ur videos to build IA Agent advanced python using RAG :
    I did pip install llama-index-experimental so many times and also the upgrade version.
    I did ' from llama_index.experimental.query_engine import PandasQueryEngine ' and it says ' no module name llama_index.experimental '.
    Weird plz anyone?

  • @PixelMotionHD
    @PixelMotionHD 5 месяцев назад

    Can "with" statement be used with modules for database operations as well?

    • @ChopLancer
      @ChopLancer 5 месяцев назад

      I've tried that with psycopg and didn't work the same. Other packages might be different but just follow their documentation

  • @Fr74n
    @Fr74n 5 месяцев назад +1

    Your content is gold

  • @neckbro
    @neckbro 5 месяцев назад +1

    Never liked the "with" thing for files, even the Python professor in college said to not use it, same for list comprehension. Why make something easy one step more complicated for the mind to translate? If its cleaner on my mind , I don't care how it looks on an editor

    • @TechWithTim
      @TechWithTim  5 месяцев назад +4

      It has nothing to do with “looking good” it’s about utilizing the context manager for safety when operating with a file. It has a real utility in that it catches and resolves and file reading/writing errors automatically for you and ensures the file is closed correctly regardless of what you do. That’s why you use it.

    • @ChopLancer
      @ChopLancer 5 месяцев назад +2

      I have had issues copying files from an FTP server from not using with. Using with prevented me from having anymore blank files.
      I probably wasn't closing them properly but never need to worry about that using with

  • @RiteKoder
    @RiteKoder 3 месяца назад

    python is so cool

  • @bayesian7404
    @bayesian7404 9 дней назад

    Typo I entered lecture and Sick changed it to electron. Lol

  • @MastaHibouw
    @MastaHibouw 24 дня назад

    so why bother with "longer_than_4" function when you could have done:
    filtered=[lstr_element for str_element in ["my", "world", "apple","pear"] if len(str_element) > 4]

  • @CultureofSpeech
    @CultureofSpeech 5 месяцев назад

    Salute 🙌
    Bravo 👏👏 Lit 🌠 Impressive 👌❤ gratitude ✨ for your satisfactory Work 💪🚀🌱

  • @AS-rg9ly
    @AS-rg9ly 5 месяцев назад +1

    Wait, are these functions or methods?

    • @johnbennett1465
      @johnbennett1465 5 месяцев назад

      Some are types. Some are functions. Some are functions that turn around and call a method on a parameter.

  • @darshankokal4670
    @darshankokal4670 3 месяца назад

    It was good but I use all the hacks that you mentioned everyday

  • @tonytranguyennnn
    @tonytranguyennnn 2 месяца назад

    I love that

  • @maloukemallouke9735
    @maloukemallouke9735 2 месяца назад

    I like your videos ,

  • @nargileh1
    @nargileh1 4 месяца назад

    Trying to think of realistic uses cases for 'map' that you can't do with comprehensions ...

    • @Wopara
      @Wopara 4 месяца назад

      I guess map just looks cleaner

  • @zyphtron
    @zyphtron 5 месяцев назад

    Tuple = "Toople", not "Taple"!

  • @emmang2010
    @emmang2010 5 месяцев назад

    Guys just come across these during development. No need to watch formal videos on these really ever.

    • @ChopLancer
      @ChopLancer 5 месяцев назад

      I disagree, he showed there are ways around using these, if you don't know it's there, how else can you learn it's there unless someone shows you

  • @joekulik999
    @joekulik999 3 месяца назад

    Dear Tim: You're even better at teaching than you are in Python. How you organized these simple functions in one video answered a lot of questions for me, particularly because of the order in which you explained them. You could be successful in teaching any subject, Tim. Perhaps you should think about that before you fully invest your young life into computer programming. ❤

  • @JohannVF
    @JohannVF 5 месяцев назад

    I can never see "rng" as anything other than random number generator....

  • @Choco794
    @Choco794 5 месяцев назад

    Anyone notice how he said maletrap instead of mailtrap.

    • @JirayuVijjakajohn
      @JirayuVijjakajohn 5 месяцев назад +2

      how could you notice the difference in pronunciation between 'male' and 'mail

    • @Choco794
      @Choco794 5 месяцев назад +1

      Oops I meant he wrote male trap instead of mailtrapsince there's no difference in the pronunciation between the two.

  • @mahdihasan42
    @mahdihasan42 5 месяцев назад

    python is getting semmiler like react js.... :)

  • @TechCodeGate213
    @TechCodeGate213 5 месяцев назад

  • @chuckfarley7642
    @chuckfarley7642 Месяц назад

    Like the video, but the word is “overwrite”, not “override”!

    • @TechWithTim
      @TechWithTim  Месяц назад

      I’m not sure what section you’re talking about but override is a valid word for many contexts, you may still be correct but override is a word

    • @chuckfarley7642
      @chuckfarley7642 Месяц назад

      Sorry, I should’ve been more clear. The part where you’re talking the open function and “a” vs “w”. To replace the contents of an existing file is to overwrite it.
      I do appreciate the video. I’m a somewhat experienced python programmer, but I was not aware of the help and enumerate functions.

  • @lapislazuli1949
    @lapislazuli1949 5 месяцев назад +2

    are you 23 years old?

    • @buuzy252
      @buuzy252 15 дней назад

      Yes he’s close to that age. He told us already when he spoke about his path as a programmer. He looks like 34 something though lol that’s krazy

  • @no99mnecfw
    @no99mnecfw 10 дней назад

    STOP SAYING ACTUALLY!

  • @shaduhhh
    @shaduhhh 5 месяцев назад +1

    First here 👇👇

  • @2Xb73OdF5
    @2Xb73OdF5 5 месяцев назад +2

    You lost me at mailplop

  • @danial9705
    @danial9705 5 месяцев назад

    First !

  • @ArhamShahid-fc5cq
    @ArhamShahid-fc5cq 3 месяца назад

    Make your video also in Hindi Please So you have more views!

  • @xmelsky
    @xmelsky 5 месяцев назад

    Waste of my time

  • @JebadiaSmith
    @JebadiaSmith 5 месяцев назад

    No thanks... Working on a computer for a living seems like it is going to become completely obsolete in less than 5 years. Why spend time learning useless things... Does anyone use cursive writing any more? It used to be the optimised form of communication.. But I would argue that every second I was taught how to cursive write was a waste of time and energy that could have been spent on more useful fundamental skills.. Now learning AGI Command prompts.. That seems to be where the future is headed.. My first computer was a MS Dos. Using functions like this used to be how it was done. But certainly not for much longer..

    • @101Mant
      @101Mant 5 месяцев назад +1

      As a coder who has used several AI code tools I have absolutely no fear for my job given the quality of the code they produce. Nor are they likely to get notably better in the future as throwing more training data at them leads to diminishing returns.
      Even if you can get it to produce the right code, you need to understand what it has produced to know it's right.
      AI has potential to be a useful aid but it's massively over hyped right now so all the startups can get that sweet VC cash.

  • @raghunathansundaresan
    @raghunathansundaresan 5 месяцев назад +3

    I've always been using key argument in sorted function by trial and error. Finally I understood. Thanks Tim great video as usual!