Python Programming Tutorial - 28 - Default Parameters

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
43,355
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 26, 2009

Part 29 - http://www.youtube.com/watch?v=z1MARRoshyU

How to use default parameters in python.

  • likes, 2 dislikes

Link to this comment:

Share to:

Top Comments

  • your tuts are gr8, keep it up. 5/5*

  • First, and yet another great vid. Keep 'em up :)

see all

All Comments (62)

Sign In or Sign Up now to post a comment!
  • @nilabjo2008 it must be 1/1 so people have only 2 choices

    umm welcome to the future

  • @PeyamCham thank you a lot, I really haven't seen my spelling failure

  • How do you do this on Python 3+? mine says 'unsupported operand type(s) for %: 'non type' and 'tuple'' Please help.

  • @harito94 you spelled "first" wrong..

    take a look at your first line...

    you have def name(fisrt=......)

    it should be "first"

  • @harito94

    typo: def name(fisrt='john') should be def name(first='john')

    

  • hey, can someone say me why this is happening . This is the source code of the program:

    def name(fisrt='john', last='smith'): print '%s %s' % (first,last)

    name() And this the output: Traceback (most recent call last): File "C:/Users/Vision/Desktop/1.py"­, line 2, in name print '%s %s' % (first,last)

    NameError: global name 'first' is not defined

    I'm using python 2.7.2

  • @Colstonewall %s %s mean first and last strings of "bucky","roberts" so the first and last strings are bucky roberts

  • @Colstonewall Look up a vid on python print formatting or string formatting. Basically the '%s's means that there is going to be something that the programmer will define at that part in the string. The percent sign is telling the print function that it is going to be formatting, and the part in the parenthesis defines what the '%s's are. The first %s is for the value stored in 'first' and the second %s is the value stored in 'last'. Hope that helped, though I'm sure you know by now. MONTH LATE

  • for those who use 3.2 u can do this tutorial like this :

    def name (first,last): print ('%s %s' % (first,last))

    follow rest of video by using it : ) give me green so rest can c it ;p

  • Loading comment...
Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more