如何用codio(python)编写包含数字的字符串

2024-09-28 22:22:08 发布

您现在位置:Python中文网/ 问答频道 /正文

# Input from the command line
# converted to an integer
import sys
number1 = int(sys.argv[1])
number2 = int(sys.argv[2])

# Your code goes here 

Ive tried:

newString = '123' + str(456)
print(newString)

newString = '123' + '456'
print(newString)

newString = '123' + str(number2)
print(newString)

newString = (number1 + number2)
print(newString)

我要么得到 程序输出

^{pr2}$

我假设得到的是输入123456输出123456


Tags: thetofrominputsyslinecommandint
1条回答
网友
1楼 · 发布于 2024-09-28 22:22:08

Im suppose to be getting Input 123 456 Output 123456

我想你把给出的一个例子问题和一般解决方案混淆了。在

你不应该只使用数字1和数字6

最接近您的答案是这样的,但是不要使用123,而是使用number1来产生预期的结果

newString = '123' + str(number2)
print(newString)

相关问题 更多 >