1. Takayuki KONDO
  2. python_lessons

Commits

Takayuki KONDO  committed 92e4960

#23 whileでループを回そう

  • Participants
  • Parent commits 8fa6d0e
  • Branches default

Comments (0)

Files changed (1)

File hello.py

View file
 # -*- coding:utf-8 -*-
-# ループ(for) / 辞書 
+# while 
 
-a = {"taguchi":200, "fkoji":300, "dotinstall":400}
 
-for k, v in a.iteritems():
-    print "key: %s value :%d" % (k, v)
+n = 0
 
-for k in a.iterkeys():
-    print k
+while n < 10:
+    if n == 3:
+        n+=1
+        continue #break
+    print n
+    n += 1
+else:
+    print "end"
 
-for v in a.itervalues():
-    print v
 
-
-