盧姵穎PYTHON陣列ARRAY串列LIST字典DIC集合SET元組TUPLE

animal = ["豬", "牛", "羊", '貓', "蛇"] #python語言的註解comments,以下命令出現 print(animal[2]) print(animal[-5]) for i in range(5):#其他語言{}代表一個區 x = '我愛' + animal[i] print(x) #使用index print('上面使用index, 下面沒用') for i in animal: print(i) x = animal.copy() print(animal) x.reverse() #將x反轉reverse print(x) animal.append('狗') print(animal) y = animal.copy() y.reverse() #將x反轉reverse print(y)

GOOGLE COLAB執行程式

519

留言

  1. 巴黎銀行,超級宇宙無敵優秀的你,應該去當總裁https://lupeiying.blogspot.com/2025/03/pythonlistarraytuplesetdict-3-10-2025.html
    Colab.https://lupeiying.blogspot.com/2025/03/pythonarraylistdicsettuple.html
    計算機確實可以執行https://lupeiying.blogspot.com/2025/03/chatgpt.html
    3月4日豬牛羊https://lupeiying.blogspot.com/2025/03/2025python-array.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

甲班盧姵穎PYTHON繪製三角函數與powerpoint製作影片

盧姵穎二分法求內部報酬率