multiple_arguments.py

来自「python编程很好的入门材料,包括讲义和源码.」· Python 代码 · 共 21 行

PY
21
字号
#-------------------------------------------------------------------------------
# Define a function that takes two arguments so we can customize our
# "Game Over!" message.
#-------------------------------------------------------------------------------

def printGameOver( playersName, totalKills ):
    print "Game Over... " + playersName + "!"
    print "Total Kills: " + str( totalKills ) + "\n"

# Now, lets call our new function and pass in some player names along with
# their total kills...

printGameOver( "camper_boy", 15 )
printGameOver( "Haxxor", 27 )
printGameOver( "c1pher", 51 )

# Note how argument order matters. Uncomment the next line to see an error.
#printGameOver( 12 "killaHurtz" )

raw_input( "\nPress Enter to exit..." )

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?