【发布时间】:2019-07-16 14:20:05
【问题描述】:
所以我有两个变量s 和c。两者都是一个单词的字符串。
我有第三个变量a。
比方说-
s=Nevad
c=Carson City
我运行的代码是 -
a=(s," is the capital of ",c)
所以当我打印 a 时,我得到的输出是 -
('Nevad', ' is the capital of ', 'Carson City')
我想要的输出是
Nevad is the capital of Carson City
另外,我可以在a 中存储 5 个句子,将其视为列表吗?如果是这样,当我打印带有多个句子的 a 时,我希望输出为 -
Nevad is the capital of Carson City
Massachusett is the capital of Boston
以此类推,直到打印完所有句子。
【问题讨论】:
标签: python-3.x string variables