Python Programming Tutorial – 28 – Default Parameters

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


Posted

in

by

Tags:

Comments

37 responses to “Python Programming Tutorial – 28 – Default Parameters”

  1. Meghav Desai Avatar

    why do we add %s ? doesn't Python directly print strings ?

  2. MsProza Avatar

    in python 3 replace print "%s %s" % (first, last) to print("%s %s" % (first,last))

  3. PrettyGoodChannel Avatar

    Thanks brother, your tutorials are super helpful

  4. merchant100 Avatar

    Do I write return or print?

  5. GameRight Youtube Avatar

    Ahhh….. It makes so much sense now… Thanks :]

  6. alotofstuff123 Avatar

    lol this comment is still up here from 2 years ago

  7. Darksource Avatar

    I mean that's why Google uses Python 2.

  8. arnas dickus Avatar

    You missed tutorial check out Buckys Python tutorial Strings n Stuff (17/43) %s – It's basically custom string for replacing words

  9. Darksource Avatar

    Python 3 is kinda buggy. (Thats why Google Python 2)

  10. Darksource Avatar

    For some weird reason the views start kicking up again at tutorial 32.

  11. Darksource Avatar

    Is it me or does it sound like bucky has been at the crack again? :/ (jokes)

  12. amsfuy Avatar

    I gonna make to it to the end. Count on it.
    We're the true Bucky lovers!

  13. Jimmy Wong Avatar

    using % to show we have a string with missing variables.
    before the % —- what the string is
    after the % —-what the variables are

  14. bob swarley Avatar

    whats the %s for ? it was not explained in the earlier tutorials, or maybe i missed it, can someone please explain thanks!

  15. TheDigitalShrapnel Avatar

    name isnt a variable like x which can be given a specific value. Since its a function you gotta go like this: name().

  16. Aaron D'Souza Avatar

    you gotta put the brackets (parentheses) in too i think

  17. Ole Eidskrem Avatar

    nothing comes when i wirte name?

  18. Jaipal Singh Avatar

    Lots of brackets in later version:
    def name(first, last):
    print(("%s%s")%(first, last))

  19. qmsp6 Avatar

    i spent almost an hour reading forums and this was exactly what i was looking for

  20. Alexander Falgui Avatar

    Bucky, only you can feed minds with unforgettable knowledge.

  21. Mizurnix Avatar

    I am using 2.7 and was getting errors before trying your version.Thanks

  22. Happy Gore Avatar

    Bucky, I hope you never forget that all the time and effort you put into making these tutorials is sooo worth it. You're a teacher to an audience of knowledge hungry students forever thankful for your contribution. Then, we go out and create. Thank you.

  23. dr4t Avatar

    if you are using python 3, then the name() function should have this line:
    print ('{0} {1}'.format(first, last))

  24. Asad Raza Avatar

    I tried to print * in diagonal fashion like this
    *
    **
    ***
    ****

    but i could'nt do it. the result for my code is print it in each row like :
    *
    *
    *

    please help me out to do this.

  25. dashbyictfd Avatar

    In the case of the following, it works in the IDLE but when I try to save it as a .py it returns nothing. What have I missed? Thanks
    def name(first,last):
    print '%s %s' % (first,last)
    name('bucky', 'roberts')

    print " "
    def name(first='tom',last='smith'):
    print '%s %s' % (first,last)
    print name(first,last)

  26. Chris Kavanagh Avatar

    The %s is a place holder for variables. So the answer to your question is, yes, but default parameters don't have anything to do with it. In other words, you don't need default params to use them. . .The %s is for strings, ie: words, and you would use %d for numbers.

  27. Muresan vlad mihail Avatar

    s is coming from string

  28. Wayne Phillips Avatar

    In Python, that's how string type variables are inserted into strings. It's explained in an earlier video in the series, although not quite as it was done in this video.

  29. Natnater Avatar

    nostalgia kick ;-:

  30. abhpro Avatar

    Now I'm completely new to Python, but I think I know why. You want the function to print a string, but if you just put print 'first, last', it would return the function as exactly 'first, last'. Using %s allows you to print a string that will change depending on what the value is. It's hard for me to explain, but I hope that helped.

  31. Red Dot Gaming Avatar

    I can tell you some of the things i have done already for practice. pm me

  32. Tudor Pop Avatar

    I need some practice….I start to forget things :(…

  33. VAHID LAFORTUNE Avatar

    This tutorial video was kind of confusing. What are tuples?

  34. TechnicalMinecraft Avatar

    28 tutorials in a day, oh god…

  35. Keith D. Cardin Avatar

    I've spent yesterday and today on these… Bucky is awesome, and I never comment on youtube videos. It's three years from when he did this video and I'm being helped. That's crazy.

  36. cengav4r Avatar

    In python 3.2.2

    def name(first,last):
    print('%s %s'%(first,last))
    name('ali','ayşe')
    ali ayşe

Leave a Reply

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