小编Joh*_*han的帖子

如何在 PYTHON 中查找输入数字的千位、百位、十位和个位中的数字?例如:256 有 6 个一、5 个十等

num = int(input("Please give me a number: "))
print(num)
thou = int((num // 1000))
print(thou)
hun = int((num // 100))
print(hun)
ten =int((num // 10))
print(ten)
one = int((num // 1))
print(one)
Run Code Online (Sandbox Code Playgroud)

我试过这个,但它不起作用,我被卡住了。

python numbers operators

2
推荐指数
2
解决办法
3万
查看次数

标签 统计

numbers ×1

operators ×1

python ×1