How To Use Functions In Python (Python Tutorial #3)

///How To Use Functions In Python (Python Tutorial #3)

How To Use Functions In Python (Python Tutorial #3)

FavoriteLoadingAdd to favorites

This entire series in a playlist:
Keep in touch on Facebook:
Subscribe to my newsletter:
Support me on Patreon:

Tips:
1. Follow along as I explain to make sure you understand everything
2. Ideally, work with a friend so you can help each other when you’re stuck
3. If you want to learn faster than I talk, I’d recommend 1.25x or 1.5x speed 🙂
4. Check the outline in the comment section below if you want to skip around.
5. Download the sample files here to follow along (they are Jupyter Notebook files):
6. To make sure you don’t miss my future tutorial videos, sign up to my newsletter:
7. Have fun! If anything is unclear, please let me know in a comment.

Keep in touch on Facebook:
Subscribe to my newsletter:
Support me on Patreon:

source

By |2019-04-27T18:31:59+00:00April 27th, 2019|Python Video Tutorials|30 Comments

30 Comments

  1. CS Dojo April 27, 2019 at 6:32 pm - Reply

    Below is an outline of this video.
    0:41: How to use sample files
    1:41: Using comments
    2:21: What’s a function? – Example 1
    4:57: What’s a function? – Example 2
    7:09: A function that takes multiple arguments
    7:58: What’s a function? – 2 more examples
    10:30: Creating a BMI calculator

    Also, a few tips:
    1. Here is the playlist for this series: https://www.youtube.com/watch?v=Z1Yd7upQsXY&list=PLBZBJbE_rGRWeh5mIBhD-hhDwSEDxogDg
    2. Follow along as I explain to make sure you understand everything
    3. Ideally, work with a friend so you can help each other when you’re stuck
    4. If you want to learn faster than I talk, I’d recommend 1.25x or 1.5x speed 🙂
    5. Check the outline in the comment section below if you want to skip around.
    6. Download the sample files here to follow along (they are Jupyter Notebook files): https://www.csdojo.io/python3
    7. To make sure you don’t miss my future tutorial videos, sign up to my newsletter: https://www.csdojo.io/news
    8. Have fun! If anything is unclear, please let me know in a comment.

  2. Laugh and Love! April 27, 2019 at 6:32 pm - Reply

    I have a doubt regarding this, how can I ask you the same?

  3. Akshay Uttam April 27, 2019 at 6:32 pm - Reply

    Great series..good work

  4. Lashy YT April 27, 2019 at 6:32 pm - Reply

    I need help plz

    I type

    Def function1():
    Print(“ahh
    Print(“ahh 2”)
    Print(“this will be outside the code”)

    SyntaxError: invalid syntax

  5. Susmita Mazumder April 27, 2019 at 6:32 pm - Reply

    what book you recommend for python

  6. Salsabel Mohamed April 27, 2019 at 6:32 pm - Reply

    Why there is no translation

  7. Dane Wilbanks April 27, 2019 at 6:32 pm - Reply

    When doing the exact same thing for the earlier function practice (@4:20 ish) It prints my outside text first, and then the function. Why is it different?

  8. Gadam Bakiyev April 27, 2019 at 6:32 pm - Reply

    hi YK,
    can you please explain the difference between "print" and "return"?

  9. Anh Do April 27, 2019 at 6:32 pm - Reply

    Can I use the sublime text instead of the Jupyter notebook?

  10. sheyi anjola April 27, 2019 at 6:32 pm - Reply

    Hi CS Dojo, been having difficulties trying to install Anaconda on my windows 10 PC. what do you recommend I do (bear in mind I have uninstalled and installed severally)

  11. Blaise gaming 12 April 27, 2019 at 6:32 pm - Reply

    Best techincal knowledge

  12. Bob Davislumbro April 27, 2019 at 6:32 pm - Reply

    Why do you input print (BMi ) twice ?

  13. Mohamed Marzook April 27, 2019 at 6:32 pm - Reply

    Hi, I am interested in learning about python but I don't have a pc or Mac , but I have a tablet can I download the anaconda or juypter notebook or python and can i use it in my tablet ? how ? plz put video that thanks.

  14. Ehn April 27, 2019 at 6:32 pm - Reply

    This is a life saver, I love how easy the explanations are and the helpful comments 💖😍

  15. Aergaia April 27, 2019 at 6:32 pm - Reply

    def convert(miles):
    km = 1.6 * miles
    return km

  16. M K April 27, 2019 at 6:32 pm - Reply

    can' t we make a calculator out of it

  17. TheProfessional April 27, 2019 at 6:32 pm - Reply

    3:11 When you're in Python, you wouldn't have to do the 4 spaces because the next line of code (after any colon) would already be indented for you but if it isn't then you can just press the "Tab" key instead of 4 spaces.

  18. Paulo Vinicius' April 27, 2019 at 6:32 pm - Reply

    Best functions classes I've ever seen. Congrats!

  19. Devon Chin April 27, 2019 at 6:32 pm - Reply

    def convert(miles):
    return miles*1.6
    km = convert(int(input("Enter miles here: ")))
    print(str(km) + " km")

    I decided to take it one step further with the challenge. Allow a user input to convert miles to km, and convert that integer to a string to show the km after the value!
    Thanks so much for these videos! I am absolutely loving learning python3 (my first programming language). And having passionate people recording tutorials like this really helps more than I could ever put into words!

  20. milan van de kreeke April 27, 2019 at 6:32 pm - Reply

    miles = 60
    conversion_factor = 0.62137119

    kilometers = miles / conversion_factor
    print(kilometers)

  21. Alex Bai April 27, 2019 at 6:32 pm - Reply

    Thank u so much for the great tutorials!!!Can U please recommand some websites to do exercises??

  22. Lightning in My Hands April 27, 2019 at 6:32 pm - Reply

    Good!!

  23. brian grey April 27, 2019 at 6:32 pm - Reply

    bmi_calculator(name, height_m, weight_kg):

    bmi = weight_kg / ( height_m**2)
    so here arguments/variables are name, height_m, weight_kg and name1, height_m1, weight_kg1 are different than name, height_m, weight_kg then when return result, how bmi knows that it has to do weight_kg1 / ( height_m1**2). i think it should only work for weight_kg, and height_m values as that values are in function and in bmi formula. weight_kg1 ,height_m1 are totally different values than weight_kg, height_m then how it works ?

  24. Andrew Vipe April 27, 2019 at 6:32 pm - Reply

    Best TEACHER EVER 😊

  25. Ádám Szentes April 27, 2019 at 6:32 pm - Reply

    Sidenote: if you use "print" instead of return, then the execution will give you the results immediately. Very awesome tutorial, btw!

  26. Nibz legend April 27, 2019 at 6:32 pm - Reply

    I want a function that accepts 4 argunemts , a function call would me my_function (1,0,1,0)
    and then I want to append that to 9 and return the answer
    91010
    how can I do that?

  27. Pamir Sahak April 27, 2019 at 6:32 pm - Reply

    Hi YK what is wrong in this coding??
    # BMI calculator
    name1 = "pamir"
    height_m1 = 1.7
    weight_kg1 = 55

    name2 = "milad"
    height_m2 = 1.7
    weight_kg2 = 90

    name3 = "manizha"
    height_m3 = 1.5
    weight_kg3 = 50
    def bmi_calculator(name, height_m, weight_kg):
    bmi = weight_kg / (height_kg * height_kg)
    print("bmi: ")
    print(bmi)
    if bmi < 25:
    return name + 'not fat'
    else:
    return name + 'is ok'
    result1 = bmi_calculator(name1, height_m1, weight_kg1)
    result2 = bmi_calculator(name2, height_m2, weight_m2)
    result3 = bmi_calculator(name3, height_3, weight_kg3)

  28. Ace Malto April 27, 2019 at 6:32 pm - Reply

    Hey im just curious if i can add something like this
    def bmi_calculator(name, height_m, weight_kg):
    bmi = weight_kg / (height _m ** 2)
    print(''bmi: *'')
    print(bmi)
    if bmi < 25:
    return name + '' is not overweight''
    else:
    return name + '' is overweight''
    else:
    return namd + '' is normal weight '' this the one i wang to add but syntaxerror

  29. Sunshine Largo April 27, 2019 at 6:32 pm - Reply

    why I get the word none????????

    what did I do

    def function4(x):

    print(x)

    print("still in this function")

    return 3*x

    f = function4(4)
    4

    still in this function

    print (f)
    none

  30. Johnny Doyle April 27, 2019 at 6:32 pm - Reply

    please help! when i am typing the code, at the side of the screen where it says "in [ )" with the number of the line, mine is always blank so my script isn't working

Leave A Comment

*