Give the parameters in the function default values,parametersvalues,def hello_3(
文章由Byrx.net分享于2019-03-23 06:03:17
Give the parameters in the function default values,parametersvalues,def hello_3(
def hello_3(greeting='Hello', name='world'): print '%s, %s!' % (greeting, name)hello_3()hello_3('Greetings')hello_3('Greetings', 'universe')hello_3(name='Gumby')def hello_4(name, greeting='Hello', punctuation='!'): print '%s, %s%s' % (greeting, name, punctuation)hello_4('Mars')hello_4('Mars', 'Hi')hello_4('Mars', 'Hi', '...')hello_4('Mars', punctuation='.')hello_4('Mars', greeting='It is a greeting!')
相关内容
- Tuple sequence,tuplesequence,X = 'spam'Y
- Reference index in a list in Python.,referencepython,foo = [42, '
- File Wildcards,filewildcards,#The glob mo
- Listing Directories,listingdirectories,import os os
- Echo command line arguments,echoarguments,'''Echo comm
- Data Compression,datacompression,import zlibs
- Global variables,globalvariables,# global sco
- Creating Unicode strings in Python,creatingstrings,print u'Hell
- Reference a variable by name,referencevariable,a = 3
- Append multiple items to a list,appenditems,L = [1, 2]L.
评论关闭