Python Programming Tutorial – 18 – Unpacking Arguments

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

43 responses to “Python Programming Tutorial – 18 – Unpacking Arguments”

  1. Muhammad Awais Avatar

    BUcky goto sleep its about to 4:00 am 😀

  2. 88SJoe88 Avatar

    data=[10,20]
    def calculaHP(age, applesEaten, cigsSmoked=19):
    HP=100-age +3.5*applesEaten -2*cigsSmoked
    print(HP)
    calculaHP(*data)
    OUTPUT = 122.0
    #You can see it inserts the data nicely and the default is used for cigsSmoked in the lack of the last datum.
    #===========================================================

    data=[10,20,19]
    def calculaHP(age, applesEaten, cigsSmoked=5):
    HP=100-age +3.5*applesEaten -2*cigsSmoked
    print(HP)
    calculaHP(*data)
    OUTPUT = 122.0
    #Still inserts the data nicely, overlapping the default value of cigsSmoked.
    #==========================================================

    data=[10,19]
    def calculaHP(age, applesEaten=20, cigsSmoked):
    HP=100-age +3.5*applesEaten -2*cigsSmoked
    print(HP)
    calculaHP(*data)
    OUTPUT = SyntaxError: non-default argument follows default argument
    #So it doesn't understand that the data are for the non default parameters?

  3. Rohit Tikle Avatar

    could you please tell me how have you found these formulas for heath calculator and boys dating age  and all?

  4. Java-Tutorial Avatar

    Thanks a lot very informative ….

  5. Paweł Brysch Avatar

    def funkcja (x,y)
    wektor = [2,3]
    funkcja(*wektor) – wstawiamy listę, która po kolei zapełnia argumenty

  6. Wolfy Wolf Avatar

    life has no mercy: i died long time ago 🙁

  7. GMByte Java Avatar

    I used to smoke a pack ciggarets a day. And now I vape. Very useful information this is.

  8. venkata rajesh Avatar

    What if there is a mismatch in list size and function argument size ?

  9. O_O Avatar

    2:13 I will subscribe for that

  10. Dark Horse Avatar

    This was really cool.

  11. The Blue Blur Avatar

    im gonna live to be 111 years old yay

  12. A Random Winner Avatar

    This seriously has to be one of the best python courses. I'm new to learning python and I'm just trying to cover the basics. Out of around 4 different courses I'm taking, this has been the best in explanation. Thanks!

  13. peng xia Avatar

    I am so confused that shouldn’t the first outcome of “0, 1, 2” be 99.5?help me please

  14. Tharun Shiv Avatar

    Thank you !! Especially for your valuable time. 🙂

  15. phendformyself Avatar

    Wow, you're going to call your viewers idiots for choosing to do something unhealthy? Tell me something that your mother chooses to do that is unhealthy, so that I may call her an idiot too. I'm not a smoker, but you self-righteous non-smokers look so hypocritical when you say narrow-minded comments like that.

  16. Manav Shah Avatar

    If you smoke cigarette, you're an idiot! – Bucky Roberts

  17. Rasbin Thapa Avatar

    according to this formula my result was: -14

  18. Sagar Sehwag Avatar

    Please come back on youtube, we miss you a lot.

  19. chris mahn Avatar

    i use to smoke. still cant stand self righteous non smokers.

  20. Yanzhen Chen Avatar

    it needs to be added one more argument named 'sleeping time' since it's 4 am still recording video

  21. Brandon Young Avatar

    what if list has too many arguments? ie buckys_data = [1, 2 ,3, 4]

  22. Elyria Avatar

    Little does he know he is slowly poisoning himself with cyanide… Mwahahahaha!!!

  23. Elyria Avatar

    Don't cigarettes do more bad than apples do good?

  24. Ran Xiao Avatar

    quit smoking years ago, best decision ever

  25. JustSimpleFact Avatar

    Any more idiots here or its only me ?

  26. Tomáš Žilínek Avatar

    The tutorial before this one was about flexible number of arguments passed to a function. We could see there that when we declare a function with * and variable in brackets its possible to have any number of entry values. In this tutorial we see that its possible to pass each item of a list into a function when we call it (also with an *). Is it possible to combine this two things?
    Like:
    def hc(*args):
    total = 0
    for a in args:
    total += a

    mylist = [1, 2, 3]

    hc(*mylist)

  27. Everett Logan Avatar

    Considering this was made back in 2014 I doubt this guy will see this, but this has been bothering me for a while now. Why does he write strings with underscores? I thought it was generally accepted that strings should beWrittenLikeThis.

    I mean, fuck, what do I know? There's a reason I'm watching HIM give ME tutorials and not the other way around, but I just thought I'd ask.

  28. Hải Sơn Dương Avatar

    Nice video! Thanks a lot!

  29. AJay Gupta Avatar

    Instead use round brackets

    def sex_calclulator(age,how_many,masturbation):
    compiler=(100-age)+(how_many)*3-(masturbation)*1.5
    print(compiler)

    ajay_data=sex_calclulator(21,0,3)

  30. Akash Jaiswal Avatar

    I've created a calculator, the user should be able to input any number of input values also the operation e.g. calculate(*args, ''add') . Is it possible!

  31. Abdalhakim Benkrama Avatar

    what if we add 4 value in the liste

  32. Flore Loriz Avatar

    At the very beggining of this series you said best tutorials ever :). So far i haven't learnt how to save my projects or is it even possible to save them as .exe? Can anyone help me?

  33. username Avatar

    never touch cigarettes in your life guys, i'm tellin ya. it is so hard to stop. i still have problems not smoking when i am out with smokers.

  34. AL Avatar

    20 apples a week keeps the bugs away

  35. TheBeePeeper Avatar

    According to this, my score is 85.5.

  36. wine cheese Avatar

    i have both 2.7 and 3.4 in my system but
    my pycharm has python 2.7 in its external libraries,not the 3.4
    How can i add 3.4 in it?

  37. WesleySnipzzz Avatar

    1 Dislike for been too much of a Nerd

  38. Da Booda Avatar

    Aw, thought that asterisk indicated a pointer, well in a way it does, but not in the way I wanted. Btw, I only smoke after sex, oh wait, did you mean cigarettes?

  39. KIA Nak Avatar

    I smoke once in a while.

  40. VictorAK47 Avatar

    1 dislike from a smoker

Leave a Reply

Your email address will not be published. Required fields are marked *