python输出百位十位个位

2025-09-22 15:49:00

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输出百位十位个位

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢