python經(jīng)典實(shí)例——條件和循環(huán)語(yǔ)句
提問(wèn)人:楊紫紅發(fā)布時(shí)間:2020-11-26
#! /usr/bin/python
#條件和循環(huán)語(yǔ)句
x=int(input("Please enter an integer:"))
if x<0:
x=0
print ("Negative changed to zero")
elif x==0:
print ("Zero")
else:
print ("More")
# Loops List
a = ['cat', 'window', 'defenestrate']
for x in a:
print (x, len(x))
#知識(shí)點(diǎn):
# * 條件和循環(huán)語(yǔ)句
# * 如何得到控制臺(tái)輸入
#條件和循環(huán)語(yǔ)句
x=int(input("Please enter an integer:"))
if x<0:
x=0
print ("Negative changed to zero")
elif x==0:
print ("Zero")
else:
print ("More")
# Loops List
a = ['cat', 'window', 'defenestrate']
for x in a:
print (x, len(x))
#知識(shí)點(diǎn):
# * 條件和循環(huán)語(yǔ)句
# * 如何得到控制臺(tái)輸入
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>