【问题标题】:How to find the remainder of a division in python? [duplicate]如何在python中找到除法的余数? [复制]
【发布时间】:2020-08-28 09:15:15
【问题描述】:

在python中,在我划分为变量(k和h)之后,我如何找到方程的其余部分?这是我的代码:

h = int(input())
print(k / h)

【问题讨论】:

  • 使用模运算符:k%h。如果你想要结果和余数divmod(k,h)

标签: python math division equation


【解决方案1】:

简单的数学就可以解决问题:

h = int(input())
print(k % h)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-23
    • 1970-01-01
    • 2011-01-27
    • 2023-02-14
    • 2016-07-02
    • 2014-12-06
    • 1970-01-01
    • 2021-12-26
    相关资源
    最近更新 更多