python函數def


#函數就是實現一個特定功能的程序塊
#下面這個函數實現了打印helloworld的功能
def print_hello():
    print('hello world!')
#這是調用方法
print_hello()
#下面的函數,實現了傳入參數的功能
#在函數中可以嵌套使用其他函數
def print_name(name):
    print_hello()
    print('hello',name)
#帶參數的調用方法
print_name('jack')

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM