python实战练习:对哪部分使用类型转换

 

 

 

 

 

l = []
while True:
    s = input()
    if s == '0':  #注意:这里是对0加引号,而不是使用int(s),如果输入'hello',int(s)会报错,所以是用字符串'0'
        break
    else:
        l.append(s)


print(" ".join(l))

 

posted @ 2023-08-13 23:28  limalove  阅读(11)  评论(0)    收藏  举报