【问题标题】:How to add 1 number together in Python?如何在 Python 中将 1 个数字加在一起?
【发布时间】:2023-01-09 21:25:58
【问题描述】:

感谢您的帮助,我终于能够添加 3 个数字,但现在我必须将 1 个数字加在一起。在 CSS 中这很容易,但我需要帮助在 Python 中完成。通常这是常识,但在这种罕见的情况下,我必须使用垃圾语言 (PHYTHON) 来执行此操作。这是我当前的 python 代码:

身体{ number = int(input('请输入数字 uno')) 执行加法 打印(n(u(m(b(e(r)))))) }

上面的代码: 身体{ number = int(input('请输入数字 uno')) 执行加法 打印(n(u(m(b(e(r)))))) }

【问题讨论】:

  • 这是什么意思“将 1 个数字加在一起”
  • 我不知道显示的代码应该是 python 还是 CSS(层叠样式表)?
  • 您提供的(伪?)代码没有任何意义。 Python 不使用 body,为什么要这样调用 print?请描述您想做什么以及您尝试了什么。
  • 请阐明您的具体问题或提供更多详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python css


【解决方案1】:

就像您描述的那样,这是 python 中的基本添加函数

# Here you ask the input from the user and store it in num1
num1 = int(input('Enter a number: '))

# Perform addition to stored num1
result = num1 + 1

# Print the result to the console
print(result)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-23
    • 1970-01-01
    • 2012-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-10
    相关资源
    最近更新 更多