呂婕綺PYTHON陣列ARRAY串列LIST字典DIC集合SET元組TUPLE

利用W3SCHOOLS

animal = ["豬", "牛", "羊", '貓']
#python語言的註解comments,以下命令出現
print(animal[2])
print(animal[-2])
for i in range(2):#其他語言{}代表一個區
  x = '我愛' + animal[i]
  print(animal[i]) #使用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執行程式

520影片

JUPYTER NOTE人工智慧平台

 
  • UL=UNDERER LIST, OL=ORDERED LIST, LI=LIST
  • 大括號{ }CURLY BRACKET, CURLY捲
  • 中括號[ ]SQUARE BRACKET, SQUARE方形
  • 小括號( )CIRCLE BRACKER, CIRCLE圓
  • 圓周CIRCUMFERENCE
  • 直徑DIAMETER
  • 半徑RADIUS

留言

這個網誌中的熱門文章

2/26使用html,css,javascript,canvas製作機算機放在同一網頁

呂婕綺Python_Javascript網路執行_EXCEL_IRR二分法