【发布时间】:2021-12-04 03:20:24
【问题描述】:
我已经完成了我想要的代码,但是遇到了一个小语法问题。
我有一些打印语句可以打印我需要的内容,但它们的间距很奇怪,我希望它看起来像一个完整的句子,逗号和句点之间没有空格。
下面是几行:
if year < 2001:
print(name, ",", "you were born in", year,".")
elif year > 2100:
print(name, ",", "you were born in", year,".")
else:
print(name, ",", "you were born in", year,", which is the 21st century.")
print(name, "'s classification is", classification, ".")
在这些行中,名称和年份是从输入中定义的,我只是对如何让它以正确的间距运行感到困惑。
感谢任何帮助!
非常感谢。
【问题讨论】:
标签: python python-3.x printf python-3.5