1. Takayuki KONDO
  2. python_lessons

Commits

Takayuki KONDO  committed 2edba8b

#10 リストを扱ってみよう(1)

  • Participants
  • Parent commits 829ff7c
  • Branches default

Comments (0)

Files changed (1)

File hello.py

View file
 # -*- coding:utf-8 -*-
-# 文字列と数値の演算
-# int float
+# リスト
 
-print 5 + int("5")
+a = [1, 2, "a", 5.5]
+b = list([3,5])
 
-# str
-age = 20
-print "i am " + str(age) + "years old"
+print a
+print b
 
+# len + * [] [start:end]
 
+print a * 5
+print len(a)
 
 
+print a[2]
 
+a[2] = "b"
+
+print a
+
+a[2:4] = ['b','c']
+
+print a