-
Notifications
You must be signed in to change notification settings - Fork 0
for循环
james.liu edited this page Jan 2, 2019
·
1 revision
for循环的简单使用
for i in range(0,10,2):
print (i)
list1=[1,2,3,4,5]
for i in list1:
print (i)
for 嵌套
for i in range(1,9+1):
for j in range(1,i+1):
print ("%d*%d=%d\t"%(i,j,i*j),end="")
print()
break的使用
james_age=18
for i in range(0,10,2):
age=int(input("input james name:"))
if age == i:
print ("你猜对了!!!")
break
elif age > i:
print ("你猜大了!!!")
elif age < i:
print ("你猜小了!!!")
print ("你已经试完了!!!,james年龄是{_james_age}".format(_james_age=james_age))
- 原来卑微、学习长大、