本文主要是介绍python-位数打印,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
位数打印练习和else子句
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210627/1624798695170429.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210627/1624803456524038.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
```
x = 54321; #int(input())
w = 10**4; #权重 10^4
n = 5; # 几位数
for i in range(5):
print(x//w); #1 5
x=x%w; #1 4321
w=w//10;
print (x,w)
print ('~~~~~~~~~~~~~~')
```
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210627/1624803518583517.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210627/1624803535331471.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
![image.png](http://www.www.zyiz.net/i/li/?n=2&i=images/20210627/1624804625530976.png?,size_14,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_20,type_ZmFuZ3poZW5naGVpdGk=)
这篇关于python-位数打印的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!