Python Tutorial for Beginners 8: Functions

Поделиться
HTML-код
  • Опубликовано: 1 июл 2024
  • In this Python Beginner Tutorial, we will begin learning how to write functions. Functions are one of the most important things to learn in Python Programming and will take us to the next level. We will learn how to create/define functions, how to pass in arguments, and also how to return values. Let's get started.
    The code from this video can be found at:
    github.com/CoreyMSchafer/code...
    Watch the full Python Beginner Series here:
    • Python Programming Beg...
    Scope Video: • Python Tutorial: Varia...
    ✅ Support My Channel Through Patreon:
    / coreyms
    ✅ Become a Channel Member:
    / @coreyms
    ✅ One-Time Contribution Through PayPal:
    goo.gl/649HFY
    ✅ Cryptocurrency Donations:
    Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
    Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
    Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
    ✅ Corey's Public Amazon Wishlist
    a.co/inIyro1
    ✅ Equipment I Use and Books I Recommend:
    www.amazon.com/shop/coreyschafer
    ▶️ You Can Find Me On:
    My Website - coreyms.com/
    My Second Channel - / coreymschafer
    Facebook - / coreymschafer
    Twitter - / coreymschafer
    Instagram - / coreymschafer
    #Python

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

  • @gbco4824
    @gbco4824 3 года назад +398

    Never thought I'd be binge watching Python tutorials

    • @Pavvithra09
      @Pavvithra09 3 года назад +5

      Same! For FA!😪

    • @omgcyanide4642
      @omgcyanide4642 3 года назад +7

      We lived the same life

    • @YouLittleBrick
      @YouLittleBrick 3 года назад +1

      @@justindominic4831 the fuck are you on about. Are you admitting to a crime?

    • @Chaithzx
      @Chaithzx 3 года назад +2

      @@YouLittleBrick may be promoting his website, which literally don't work like it's supposed to

    • @eventeklay4618
      @eventeklay4618 3 года назад +1

      @@YouLittleBrick r u even learing programming why are u saying such as bad word in this here

  • @dontwatchmydoomvideos
    @dontwatchmydoomvideos 4 года назад +302

    been here for 7 seconds, already better than my college professor. don't waste money on a class for this.

    • @seanli75
      @seanli75 4 года назад +6

      pretty funny

    • @Aulin001
      @Aulin001 4 года назад

      Yes i too agree with you @Alex L

    • @CodeineKakashi
      @CodeineKakashi 3 года назад +5

      exactly why I look for these videos. I pay money to RUclips search everything.

  • @JM-co6rf
    @JM-co6rf 7 лет назад +438

    Yes! "an executed function is equal to the RETURN value" brilliant! Finally somebody explained this to me! CodeAcademy failed to explain this, as well as other youtube channels. SUBBD

    • @LopogaX
      @LopogaX 6 лет назад +9

      I have seen many tutorials about functions and all of them failed at explaining how a function works

    • @petrockspiracy3120
      @petrockspiracy3120 6 лет назад +9

      Agreed. Return was very confusing for me and if someone had just said that at the beginning it would have made it easy to understand.

    • @austinsmith435
      @austinsmith435 6 лет назад +3

      Yeah, same here. This guy was pretty good at explaining everything.

    • @otakuhigh8788
      @otakuhigh8788 5 лет назад

      what software do I have to download to code on that?

    • @sydsgraphics5108
      @sydsgraphics5108 5 лет назад

      I know the frustration of it and immediately I'm thankful to those videos where I got it and the ones where I didn't get it. What is most important is you now have it

  • @pchebbi
    @pchebbi 6 лет назад +572

    Your teachings are thorough. Your teachings are complete, precise. Your teachings dispel confusions and brings-in clarity. So much of sincerity and totality in your commitment to teaching is visible in each of your video! I must applaud you. Take a bow... Mr. Corey!

    • @absar66
      @absar66 6 лет назад +4

      Fully agree

    • @pinochska
      @pinochska 6 лет назад +3

      Truest comment on RUclips

    • @allinman4028
      @allinman4028 5 лет назад +3

      His classes are best so far.

    • @bradleytough
      @bradleytough 5 лет назад +5

      I find that sometimes certain truths/knowledge are assumed. For example, 7.33 - 7.36... "i'll just pass this in with a '.format' "...I was lost.

    • @savitaprabhakar3010
      @savitaprabhakar3010 5 лет назад +4

      THE MOST NERDY COMMENT IVE BEVER SEEN XD

  • @reissner1967
    @reissner1967 5 лет назад +54

    I love that your videos are FAST paced, CLEAR with no idle chatter and with QUICK examples that show every aspect of what you are teaching. Of all the Python tutorials, yours are the best. :)

    • @coreyms
      @coreyms  5 лет назад +8

      Thanks!

    • @tehyonglip9203
      @tehyonglip9203 7 месяцев назад

      this is what I call padding, they did it so they can monetize the video with minimum info.

  • @dennismegaffin4885
    @dennismegaffin4885 7 лет назад +187

    very professional, no "umm"ing, direct, concise, each point logically builds upon the last. Very impressed. I am progressively working my way through all of your videos. Thank you!

    • @otakuhigh8788
      @otakuhigh8788 5 лет назад +1

      what software do I have to download to code on that?

    • @TheSwaggerLagger
      @TheSwaggerLagger 5 лет назад

      @@otakuhigh8788 His first videos go over that. He's using Sublime Text.

    • @peterosoo5668
      @peterosoo5668 5 лет назад

      how are you now

    • @sdvelu
      @sdvelu 4 года назад +1

      @@otakuhigh8788 use pycharm

    • @vaibhavkrkm
      @vaibhavkrkm 3 года назад

      @@otakuhigh8788 There are various IDEs and text editors which you can use to code in Python like Sublime Text, Pycharm, Spyder, Notepad++.. each of them has their own pros and cons..

  • @thelearner9756
    @thelearner9756 Год назад +15

    just finished this 20 min lecture in 1 hour , your each word contains so many information that is way beyond the expectations ,
    Thanks a lot Sir for teaching function

  • @sebastiancaro7713
    @sebastiancaro7713 3 года назад +7

    Who else is watching this in 2020? I've learned more from you than any of my professors during my college experience! Keep up the great work!!!

  • @theamazingspiderduck
    @theamazingspiderduck 6 лет назад +86

    I can't thank you enough for how straight forward learning python has been since watching your tutorials from the very beginning. Thank you for posting these awesome tutorials. I wish i could provide more support to your channel other than liking and subscribing but once my finances improve, you will definitely be my first patreon subscription.

  • @dapperdudedan
    @dapperdudedan 4 года назад +20

    I've never used Python before in my life, let alone functions in Python. This explanation made everything clear as day. Thanks!

  • @danielm3977
    @danielm3977 5 лет назад +12

    2019 , I'm watching this and enjoyed it . Thank you Corey. That was thorough and awesome .

  • @jacoblim9439
    @jacoblim9439 5 лет назад +25

    My mind is clear and peaceful after watch this lesson. Finally i can understand others tutorials better.
    Thanks for explaining functions in details. I needed this for long time.
    I will forever be grateful about that

  • @iscottjones
    @iscottjones 4 года назад +3

    I've spent so much time trying to understand functions and you are the only one that has explained it clear enough for me to understand. Thanks for this!

  • @elisapfau8563
    @elisapfau8563 3 года назад +6

    Corey, I'm working my way through your Python Programming Beginner Tutorials playlist. I just want to stop and say I'm so grateful that I found your videos. In addition to clearly having a deep knowledge of Python (and programming in general), you are *such* an incredibly gifted and skilled teacher. Thank you for putting such care into these videos and making them free to anyone who wishes to learn. You are making STEM more inclusive and accessible for everyone, and frankly that makes you The Man.

  • @_KobbyOb
    @_KobbyOb 2 года назад +3

    I'm glad I got to see this video. Cleared my difficulties with functions

  • @dharmateja623
    @dharmateja623 3 года назад +5

    The so long confusion about args and kwargs ended here . Crystal Clear explanation. Thanks Corey :)

  • @rafasantos23
    @rafasantos23 4 года назад +16

    I was needing to know more about *args and **kwargs, thanks for helping and explain this arguments

  • @demolazer
    @demolazer 2 года назад +7

    I thoroughly recommend having an IDE open alongside to code along with the tutorial. Really helps learn. I find by just watching a Python video I barely retain any of it.

  • @Michael-iz2qd
    @Michael-iz2qd 4 года назад +6

    This is great! I am new to Python and by just reading the book for my class I was having a hard time, but after this video I have gained a better grasp on how it all works! Thank you!!

  • @afshinsalehi2136
    @afshinsalehi2136 7 лет назад +83

    the only tutorial which made me learn functions right !
    thanx...

    • @coreyms
      @coreyms  7 лет назад +10

      Glad it helped!

    • @sysadmin9396
      @sysadmin9396 5 лет назад

      Bro same here. So much clarity now. Thanks Corey.

    • @savitaprabhakar3010
      @savitaprabhakar3010 5 лет назад

      @@coreyms /yoER tHe beSt

    • @gideonbowman2689
      @gideonbowman2689 4 года назад

      Yes this has made things seem much more clear.

    • @bharathr3722
      @bharathr3722 4 года назад

      @@coreyms thanks for sharing your knowledge. It helped me a lot

  • @dave24-73
    @dave24-73 2 года назад +2

    Hi Corey, I’m learning Python and my lecture has a habit of making simple things hard, I’ve watched two of your videos and been able to get up to date, and you have managed to give me more depth and detail in 30 minutes where as I have had 2 hour classes and come out confused. Keep the videos coming they are a real benefit to people new to Python.

  • @kianushghahari3038
    @kianushghahari3038 11 месяцев назад +1

    This is how a beginner's course should be. Fast, clear and straight to the point with no new or confusing stuff that leaves one hanging. People would pay for your videos on a source like UDEMY and as a person living in a country with no online payment possibility I seriously appreciate you work. And the fact that it's actually an Englishman teaching the course is just cherry on top. Cheers Mr.Schafer.

  • @davidbarrow
    @davidbarrow 5 лет назад +14

    def stands for "define", Thanks for the tutorials best on RUclips ;)

  • @sashashavit8179
    @sashashavit8179 5 лет назад +2

    seriously man you're the best. NO BS and fast..

  • @simeonincognito6245
    @simeonincognito6245 6 лет назад

    Best Python lessons on the whole RUclips so far. Thank you!

  • @2011yhc
    @2011yhc 6 лет назад +1

    The way the leap year is defined is beautiful. I would never be able to write that in such a clean way!

  • @markkennedy9767
    @markkennedy9767 Год назад

    Definitely better than most Python tutorials on RUclips. Your description of the leap year function was very clear.

  • @sulaiman1408
    @sulaiman1408 Год назад

    Thank you, Corey. Every time I search on something about python, I hope I find a tutorial from you. You are the best.

  • @TheEmperorXavier
    @TheEmperorXavier 3 года назад +1

    its amazing how i was able to pick up these concepts of functions and the various arguments *args and **kwargs, and really understand it. your explanations and examples are really good

  • @ThatsMyCoffee
    @ThatsMyCoffee 4 года назад +1

    Thank you. I watched 2 other videos on functions and it didn't 'click' until I watched yours. Wrote my code and it ran successfully! Re-wrote it a different way and that also works.

  • @RyanTW23
    @RyanTW23 Год назад +12

    This is probabely the best Python tutorial I've ever watched. Thank you so much.

  • @iy.ak01
    @iy.ak01 2 года назад +1

    Video paused at 12:29, *mouth opened, *eyes popped, #MINDBLOWN at how you make this simplified.
    Thank you so much. Prolly gonna binge-watch your videos all weekend.

  • @owenpearson1193
    @owenpearson1193 4 года назад +2

    Great tutorials. You manage to explain everything so well unlike some other courses!

  • @jy_chen
    @jy_chen 7 лет назад +1

    Your tutorial is very helpful for beginners, they are very structured and easy to follow, and thorough! thank you so much i hope to learn more from you!

  • @rauberhozenplotz7009
    @rauberhozenplotz7009 4 года назад +9

    Your style of teaching is absolutetly great. Similar to Andrew Ng from Stanford University. Clear and elaborated. Thank you for uploading this.

  • @habibmgadmi926
    @habibmgadmi926 5 лет назад +1

    Awesome you have it all, you are the Best Teacher I ever had! Thank you, Mr. Corey

  • @kendout
    @kendout 7 лет назад +2

    the most explicit tutorial that i ever see!!! you did a very good job sir!

  • @Nobody-Nowhere-Nothing
    @Nobody-Nowhere-Nothing 5 лет назад +6

    Crisp, solid and well paced explanations. These videos are a godsend, thank you for making these.

  • @gunjanpatel1929
    @gunjanpatel1929 4 года назад

    Wonderful. Before I watch this video i check almost all the website but finally I watch yours and its explained me so easy and clearly.
    Thanks for your teaching.

  • @callmehey
    @callmehey 6 лет назад +6

    I'm a manual tester for more than 5 years now and I'm planning to transition to automated testing. I found your videos and I immediately got drawn to them. You're awesome! After finishing all of these, I hope I can start with learning Selenium Webdriver using Python. Thank you very much!

  • @kiranananthu53
    @kiranananthu53 6 лет назад

    Thanks a lot Corey!, I'm getting more confident in understanding Python, by watching your videos. Your explanation are excellent and very much in detail.

  • @joechen8403
    @joechen8403 2 года назад

    This is by far the best python tutorial I’ve seen. Thanks and great work!

  • @deafrider
    @deafrider 5 лет назад +4

    finally I understood what the purpose of these stars is :D Thank you!

  • @dns3111
    @dns3111 5 лет назад +75

    1 min on youtube > 7weeks in college :)

    • @blissfulblake2005
      @blissfulblake2005 4 года назад

      Bro, I feel that. I've got a program due tonight that I'm speed running

    • @ToriKo_
      @ToriKo_ 4 года назад

      GoJoshua007 hit those gold splits boii

    • @canaldumarcio2509
      @canaldumarcio2509 3 года назад +2

      To be honest I thought I was the only one facing this kind of issues at the university. I don´t know what is happening in fact, but I have a strong feeeling that the root reason of all these things is the way they usually teaching the subject. Most of them are stucked and they think they don´t need to chage their mind, because they are professor. Ancient mind to solve nowadays problems doesn´t work!!!

    • @oliverr2667
      @oliverr2667 3 года назад

      Yes bro..! You are correct..!

  • @gulnazkordanova7480
    @gulnazkordanova7480 5 лет назад +2

    Your tutorials are amazing! Thank you for all of your job!

  • @JR-xb5id
    @JR-xb5id 7 месяцев назад

    The is_leap & days_in_month is one of the most beautiful examples of defining a function.
    Thank you Corey for sharing this.

  • @basuraexe
    @basuraexe 4 года назад +1

    I scroll only to find others comment the exact thing I feel. It's good to know that the feeling is mutual. Your videos truly are the only Python videos worth watching on this site. People actually understand what's going on. Keep up the great work!

  • @Milark
    @Milark Год назад +1

    This part right here, especially the meaning of 'return' is a point I often got stuck on during my previous attemps at learning python. But I understand it incredibly clearly right now.

  • @sarahmehta6884
    @sarahmehta6884 4 года назад

    The way you explained function was amazing, props to you!!

  • @kasten2005
    @kasten2005 Год назад +1

    Bro, I watched several tutorials but no one dived into args and kward before at this point except you. This channel should be saved at any price

  • @unverozkol
    @unverozkol 2 года назад +1

    This is a true gem. Thanks Corey.

  • @Habaneroranger
    @Habaneroranger 4 года назад +2

    Great, clear, and concise video. Thanks!

  • @balapaudel
    @balapaudel 6 лет назад +2

    Thank you. Liked your video and subscribed your channel. I see that almost all mentioned about your excellent teaching method which I completely agree, and also your voice quality brings the much needed assurance that 'you can learn to code too', very few seem to notice this. Thank you once again.

  • @sujaa1000
    @sujaa1000 3 года назад +2

    Thanks Corey, I am progressing in Python, and I am loving it, every minute of the teaching. And because of your teaching I am loving Python too.
    Please make some competitive programming in Python too, if time permits.

  • @sebgrindley5163
    @sebgrindley5163 3 года назад +1

    Best video about Functions on RUclips. Very helpful and it clicked straight away. Subbing now.

  • @lucasmachado473
    @lucasmachado473 3 года назад

    From someone who has digged many yt videos about how functions work, you nailed it

  • @m0neez
    @m0neez 5 лет назад +62

    00:00 def intro
    07:00 passing arguments
    10:27 args & kwargs
    15:01 example

  • @pidelisnjenga8120
    @pidelisnjenga8120 6 лет назад +2

    Thank you so much Sir,
    your tutorials are awesome. I had to recheck if am subscribed because I cannot imagine missing any videos.
    I am getting every concent in black and white.

  • @soumyazyx
    @soumyazyx 4 года назад

    Thank you Corey for your time and effort. Keep spreading the knowledge.

  • @adityajawla723
    @adityajawla723 4 года назад +1

    Thanks a lot for such detailed video about function !!!
    Everything explained in details and depth with simple to understand.

  • @YAakash
    @YAakash 7 лет назад +9

    I loved the explanation of *args and **kargs. hoping if u could make a vid on how a python experience guy understands new things or what happens in their minds (how they understand things and read Python codes) when a new version of Python releases or any module to understand its function and bring that to use for projects.

  • @christopherLife
    @christopherLife 6 лет назад

    Liked, subbed, turned on notifications! I finally understand functions a lot better now, thanks to the way you approached the subject in this video! Thank you, you're amazing!

  • @SuperScarboroughfair
    @SuperScarboroughfair 3 года назад

    The best channel I ever found for self learning coding, it is just great!

  • @brunoazria3230
    @brunoazria3230 7 лет назад +19

    Sir, excellent tutorial. Thank you.

  • @dinozaurka7004
    @dinozaurka7004 3 года назад

    I love how easy you make it. My teacher couldn't completly explain what is the difference between "return" and "print" in functions. Like here I got it right away.
    subbed ofc

  • @nothingwrong988
    @nothingwrong988 4 года назад

    The most satiating and complete tutorial on youtube. You are the best..

  • @iLoveTurtlesHaha
    @iLoveTurtlesHaha 6 лет назад +5

    OMG, dude you are freaking amazing. Your friends are lucky to know you. Subscribed!

  • @kacperptak7881
    @kacperptak7881 5 лет назад +1

    thanks for this i completly forgot how to use the def function you reminded me great vid dude

  • @someRandomUserAccount
    @someRandomUserAccount 5 лет назад +2

    wish i had a tuter like you. you are a great teacher 👍

  • @user-td2rq9bp5z
    @user-td2rq9bp5z 3 года назад

    comfortable learning experience! I have watched dozens of coding youtuber and you are the first one who teaches *args and **kwargs in the function part.

  • @jaywalkingly
    @jaywalkingly 5 лет назад +2

    I liked the example at the end, it was very helpful.

  • @kencheok1769
    @kencheok1769 3 года назад

    The explanation is so simple yet effective.

  • @karthickraju4516
    @karthickraju4516 5 лет назад +3

    Instantly subbed after watching one of your videos. This is the best Puthon channel I've seen. Keep up your Great work

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

    6 years later and I am glad I found your tutorial. My professor needs to come intern for you to learn how to teach Python.

  • @louierichardson123
    @louierichardson123 4 года назад +1

    The best explanation I have found, and it is free! Thank you sir

  • @VictorOlet
    @VictorOlet 4 года назад +2

    One of the things I appreciate is you help us understand the little nuances - like the difference between printing "hello_function()" and "hello_function". I always wondered why I should have the brackets at the end.
    Thank you!

    • @edmel144
      @edmel144 4 года назад

      Is the function name with out parentheses like a C pointer to an instantiated version of the function, or something like that?

    • @VictorOlet
      @VictorOlet 4 года назад

      @@edmel144 From how I understand it, writing the function without parentheses is a reference to the function itself as an object (as opposed to calling the function for use). Therefore, printing the function without the parentheses gives details about the function object, its location in memory etc.
      That's how I understand it.

  • @dotterel
    @dotterel 4 года назад +13

    I feel like you could explain toothpaste leaving a tube and it'd be articulate and sound cool. Thanks a lot for this video, it's helped me a lot.

  • @test_popytu652
    @test_popytu652 Год назад +1

    Best tutorials for simple reason:
    topic is nailed by explaining core of the concept and proving an example that needs a 'light-bulb' in order to be solved

  • @fabiolsmineiro
    @fabiolsmineiro 2 года назад +1

    wow!!!😯 Man, your explanation is really above the average.

  • @sarimrizwan2690
    @sarimrizwan2690 2 года назад

    you are so descriptive in these tutorials , love it

  • @robbiedeegan3121
    @robbiedeegan3121 2 года назад +1

    Really enjoyed this video, thanks for making these tutorials

  • @CDT0000
    @CDT0000 Год назад +1

    You explain much more detail than Mike's video, I have so many question after I watched his video.

  • @AbhishekR
    @AbhishekR 5 лет назад +1

    ! You teach in style!!. Thanks great man!

  • @matttube9369
    @matttube9369 2 года назад

    One of the best explanations Ive seen so far easily

  • @siddharthsingh4095
    @siddharthsingh4095 3 года назад +3

    Corey , always been a fan and your channel is helping me a lot . I just have one thing to ask can you make some videos in which you discuss some standard practice questions and some great projects ; that would be very helpful . Again thanks a lot !

  • @fpmfdlslb
    @fpmfdlslb 4 года назад +1

    Really amanzingly explained!! Congrats and Thank you for your noticeable effort

  • @arindamghosh3787
    @arindamghosh3787 3 года назад

    Such a nice way to teach ...Cleared all the confusion regarding UDF .. Thanks a lot

  • @brandoncazares8452
    @brandoncazares8452 2 года назад

    Thanks a lot Mr. Corey Schafer. Your video's very helpful and helped me out more than my college professor.

  • @khansaheb9983
    @khansaheb9983 4 года назад

    Finally Understood Functions!!
    Thanks mate

  • @reeceraeburn221
    @reeceraeburn221 5 лет назад

    Thank you! I was confused about my code but you've helped me fix it :)

  • @sfundoy5dube59
    @sfundoy5dube59 3 года назад +1

    You're the best tutor ever sir, believe it. Your work is much appreciated sir

  • @jkim1263
    @jkim1263 6 лет назад +2

    Awesome Python function video, thanks!

  • @elhamiid9884
    @elhamiid9884 4 года назад +2

    It is very hard to get nice teachers like Corey Schafer in ordinary schools; mostly we got a bunch of mediocrity services in many schools including some that are very expensive. Mostly I have learnt many of computer applications, hardware and programming skills thru self learning using beautiful skills from nice people like Corey;
    They can explain something in 21 minutes and you learn everything that could take you a year and half without understanding while in many schools.
    kudos Corey; keep it up.

  • @mahmoodulhassan6607
    @mahmoodulhassan6607 Год назад +1

    Very informative and exciting. Thanks

  • @2003MAAP
    @2003MAAP 5 лет назад +1

    I don't just to leave comments, but I had having troubles with this syntax for a week and I just crossed with you videos now and everything start to get clear, thanks a lot!!!!

  • @paulinski686
    @paulinski686 3 года назад

    Thank you Corey, you make learning really easy!

  • @ashwin1698
    @ashwin1698 6 лет назад +1

    Your explanations were simple. Subscribed. Thank you Schafer!.

  • @nicholi8933
    @nicholi8933 5 лет назад

    I was not understanding functions, but this video was so helpful. Thank you a lot.

  • @darrenwild6451
    @darrenwild6451 3 года назад +1

    OMG!! ty sooo much i have been working on my code cause of an error for 5 hours and u legit solved it in 5 sec ilysm :DD

  • @AliBakr-fr9qt
    @AliBakr-fr9qt Месяц назад

    I am from Egypt and I enjoyed your explanation and learned from the video🔥