有个python代码,从倒数第四行开始不懂,求大神解释
catnames=[]whileTrue:print('Enterthenameofcat'+str(len(catnames)+1)+'Orenternothingto...
catnames=[]
while True:
print('Enter the name of cat'+str(len(catnames)+1)+
'Or enter nothing to stop.')
name=input()
if name == '':
break
catnames=catnames+[name]
print('The cat names are:')
for name in catnames:
print(''+name) 展开
while True:
print('Enter the name of cat'+str(len(catnames)+1)+
'Or enter nothing to stop.')
name=input()
if name == '':
break
catnames=catnames+[name]
print('The cat names are:')
for name in catnames:
print(''+name) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询