python输出百位十位个位

时间:2026-02-14 01:22:20

1、点击File

打开python编辑器,点击“File”。

python输出百位十位个位

2、点击New File

点击打开选项中的“New File”。

python输出百位十位个位

3、输入代码

number = int(input('请输入一个三位数:'))

a = number%10  #个位

b = number//10%10  #十位

c = number//100  #百位

print('%d的百位是:%d'%(number,c)) 

print('%d的十位是:%d'%(number,b)) 

print('%d的个位是:%d'%(number,a))

python输出百位十位个位

4、点击save as

在file选项中点击save as,保存文件。

python输出百位十位个位

5、运行代码

在run选项中点击run module运行代码。

python输出百位十位个位

6、输入数字

按提示输入一个三位数的数字。

python输出百位十位个位

7、得出结果

按回车键即可输出这个三位数的个位、十位和百位数字。

python输出百位十位个位

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com