位置:首頁 > 軟件操作教程 > 編程開發(fā) > Python > 問題詳情

在python中2. 一個(gè)函數(shù)的例子

提問人:楊紫紅發(fā)布時(shí)間:2020-11-18

每周生產(chǎn)X個(gè)罐子,計(jì)算出一年中每周位置總共生產(chǎn)的罐子。

def spaceship_building(cans):

     total_cans = 0

     for week in range(1, 53):

         total_cans = total_cans + cans

         print('Week %s = %s cans' % (week, total_cans))


繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部