pyhton 練習

條件分支語句

score = 95

if score >= 60:

if score >= 70:

if score >= 80:

if score >= 90:

print 'you score level is A'

else:

print 'you score level is B'

else:

print 'you score level is C'


else:

print 'you score level is D'


else:

print 'you have many space to improve'


while循環語句 

----------------循環打印1-100---------------

i = 0

while i < 100:

i += 1

print i

----------------打印1-100間的奇數-----------

i = 1

while i < 100:

 if i%2 == 1:

 print i

 i +=1

----------------打印1-100間的3的倍數-----------

i = 1

while i < 100:

 if i%3 == 0:

 print i

 i +=1


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章