my_l1:str = "0101011"
我执行这段代码:
for character in my_l1:
if character != '0' and character != '1':
print (f"{my_l1} is not a binary number")
else:
print(f"{my_l1} is a binary number")
我得到这个输出:
0101011 is a binary number
0101011 is a binary number
0101011 is a binary number
0101011 is a binary number
0101011 is a binary number
0101011 is a binary number
0101011 is a binary number
如何获得像这样的单行输出?
0101011 is a binary number.
拉莫斯之舞
慕标琳琳
繁花如伊
相关分类