メモ03【append】
append_その2 コードは以下になります。
1 2 3 4 5 6 7 |
def culc(a, b=1, squares=[], cubes=[]): months = ['January', 'March', 'May', 'July'] months.append('September') for month in months[:]: if len(month) > 5: months.insert(0,month) print(months) |
■ 実行結果
1 2 |
['January', 'January', 'March', 'May', 'July', 'September'] ['September', 'January', 'January', 'March', 'May', 'July', 'September'] |
3行目の「months.a…