10. Functions [Python 3 Programming Tutorials]

Sdílet
Vložit
  • čas přidán 20. 07. 2024
  • In today’s session, we will talk about “functions” in python. The video will explain the introduction of “functions”, why “functions” are needed, encapsulate code in a function, default arguments, the difference between “local and global variables” and “document strings”.
    Exercise: github.com/codebasics/py/blob...
    Topics that are covered in this Video:
    0:00 Functions introduction
    0:54 why functions are needed
    3:09 encapsulate code in function
    3:24 Define function
    10:22 Name argument
    11:09 Global vs Local Variables
    12:47 Default variable
    14:14 Document strings
    Do you want to learn technology from me? Check codebasics.io/ for my affordable video courses.
    Next Video:
    11. Dictionaries and Tuples [Python 3 Programming Tutorials]: • 11. Dictionaries and T...
    Website: codebasics.io/
    Facebook: / codebasicshub
    Twitter: / codebasicshub

Komentáře • 57

  • @codebasics
    @codebasics  Před 2 lety +3

    Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners

  • @Drampam
    @Drampam Před 4 lety +20

    According to PEP 8 it's important to skip 2 lines after function block. Just for beginners to pay attention on that

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

    Extremely glad to watch all your videos regarding python and data science. You explained it not only quiet well but extremely well. Thank you. Looking forward to watch all your upcoming lessons.

  • @skkkks2321
    @skkkks2321 Před 5 lety +10

    Loving your simplicity and evenly broken module.Would it be possible for you to make a video series with Project like Data Science.Thank you

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

    Really clear explanation sir,Great work. Thank you so much

  • @mousumimaity796
    @mousumimaity796 Před měsícem

    A helpful video to make clarity on if condition, for loop etc.

  • @RM-lb7xw
    @RM-lb7xw Před 3 lety +4

    Loving this series. Any chance you are going to make a series on Data Structures and Algos in the future? Would really love to learn from you.

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

      I already have a series (I am working on adding algo videos but DS videos are already there). in youtube search "codebasics data structures and algorithms in python"

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

    Here is the link of exercise along with the solution, please work on it as it will make your learning solid: github.com/codebasics/py/blob/master/Basics/Exercise/10_functions/10_functions_exercise.md

  • @shubhacshekar6197
    @shubhacshekar6197 Před 2 lety

    Great hard work really appreciate your simplicity in explaining beginners.Thanks sir.

  • @pushpayerraguntla3250
    @pushpayerraguntla3250 Před 3 lety

    This is awesome code man,thanks a lot. God bless you

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

    you are really great sir,i respect your altruistic work

    • @codebasics
      @codebasics  Před 4 lety

      Prakhar, I am happy this was helpful to you

  • @vamsi3087
    @vamsi3087 Před 4 lety

    What is the meaning of def add_numbers(file:tel_num:set)->set:
    Pass

  • @malikhassanabdulrehman6897

    Why do we need 2nd loop to print stars when we can do it with just a single main for loop?

  • @anuruddhtamrakar5911
    @anuruddhtamrakar5911 Před 3 lety

    while using default argument letting b=0 if we give variables as user input and then it shows error sir. How can we overcome it?

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

    Learn data science with python and pandas: czcams.com/video/CmorAWRsCAw/video.html

    • @buddhasatta
      @buddhasatta Před 3 lety

      do u have practice questions which i can use to practice codes

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

    In your exercise solution for printing stars, two loops are used . I used the below code to get the same solution. Can i have your comment on this, please
    def printStars(endNumber) :
    total = ""
    for i in range(1,endNumber+1) :
    total += "*"
    print(total)
    printStars(5)

    • @kanwarpreetsachdeva7410
      @kanwarpreetsachdeva7410 Před 2 lety

      def print_pattern(num_lines=5):
      for i in range(num_lines):
      print("*" * (i+1))
      return None
      print("Print pattern with input=4")
      print_pattern(4)
      print("Print pattern with input=6")
      print_pattern(6)
      print("Print pattern with no input")
      print_pattern()

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

    You should be in teaching field not in industry. Academics need people like you for good understanding of programming.

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

      I am moving to teaching field by teaching on CZcams already ☺️

  • @MrShinshan89
    @MrShinshan89 Před měsícem

    in the solution for print * can we not use just one for loop like below
    def print_pattern(num):
    n = range(num+1)
    for value in n:
    print (value * "*")
    pulp = print_pattern(3)
    print(pulp)

  • @arisgacha296
    @arisgacha296 Před 3 lety

    Thank you for your helpful.

  • @devloper_hs
    @devloper_hs Před 3 lety

    Sir why haven't you included **ke for giving multiple arguments in a fn

  • @pahadiculture1912
    @pahadiculture1912 Před rokem

    Thanks sir

  • @hirakdas770
    @hirakdas770 Před 3 lety

    great

  • @Griffindor21
    @Griffindor21 Před 3 lety

    Excellent video!
    There's an exercise? I can't find it here.

  • @pranavikulkarni215
    @pranavikulkarni215 Před 2 lety

    i am super gladd i found this damnnnnnn!

  • @TonydeSa
    @TonydeSa Před 3 lety

    You've mentioned that you have posted exercises after each video. Can't seem to find them. Can you please post a link to the exercises? Your tutorials are great and working on exercises after them would help to fix them.

    • @codebasics
      @codebasics  Před 3 lety +2

      Actually I am realizing I had posted them in my old series which had a background music. Many people didn't like the music so I had to make the playlist private. Also not all tutorials had an exercise. Can you do one thing? Go to my GitHub repo. GitHub.com/codebasics/py there you will find a folder called basics/Hindi. Here there are tutorials along with exercises description which is in .md file and that will have an exercise as well as a link for a solution

    • @codebasics
      @codebasics  Před 3 lety +2

      I am also going to do a new series on python with better content and exercises

    • @TonydeSa
      @TonydeSa Před 3 lety

      @@codebasics Appreciate your efforts. Thank you

    • @prasadukandregula3478
      @prasadukandregula3478 Před 3 lety

      @@codebasics Hello thanks for your Python tutorial. As mentioned by you, when can we expect new series on Python. Actually, I am about to learn Python. So asking. Thanks in advance for your answer.

  • @fitarmy749
    @fitarmy749 Před 4 lety

    I want to learn machine learning and AI will this course be effective to my path?

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

      Yes it should be. After finishing python tutorials I have pandas tutorials playlist and machine learning tutorials so you can watch them

    • @fitarmy749
      @fitarmy749 Před 4 lety

      @@codebasics thanks teacher

  • @shradha_payal
    @shradha_payal Před rokem

    where is the smaple exercises?

  • @vishalithakur6403
    @vishalithakur6403 Před rokem

    Sir i could understand

  • @anmolgupta861
    @anmolgupta861 Před 2 lety

    Sir mere Jupiter me error bta rha h

  • @thulasiram1999
    @thulasiram1999 Před 2 lety

    Anyone Please explain that line total = total + item icant understand

  • @informationbhargav
    @informationbhargav Před rokem

    sir i wanna internship. if you give

  • @balakrishnareddithala8718

    Professor....

  • @farahamirah2091
    @farahamirah2091 Před 3 lety

    Im sorry sir., Its difficult to understand the exercise., I try to make it by myself without looking solution, for example, the exercise say, input value., So I try to make user put an input.,then i got blur, i go to the solution, the input is already given.

  • @ArjunDas
    @ArjunDas Před rokem

    everything checked but i still got result as:
    Tom Expenses: 2100
    Joe Expenses: 200

    • @vedikagupta407
      @vedikagupta407 Před 5 měsíci

      actually same here...idk why is this happening