Python:四位数字,每位相加和的函数 ( day08_exercist01 )

Python:四位数字,每位相加和的函数 ( day08_exercist01 ),第1张

概述1 number = int(input(‘请输入四位整数:‘)) 2 result = number % 10 3 #累加十位 4 result += number // 10 % 10 5 # 累加百位 6 result += number // 100 % 10 7 # 累加千位 8 result += number // 1000 % 10 9 10
@H_404_8@ 1 number = int(input(请输入四位整数:@H_419_16@))@H_404_8@ 2 result = number % 10@H_404_8@ 3 #累加十位@H_404_8@ 4 result += number // 10 % 10@H_404_8@ 5 # 累加百位@H_404_8@ 6 result += number // 100 % 10@H_404_8@ 7 # 累加千位@H_404_8@ 8 result += number // 1000 % 10@H_404_8@ 9 @H_404_8@10 @H_404_8@11 print(累加结果:+str(result))
总结

以上是内存溢出为你收集整理的Python:四位数字,每位相加和的函数 ( day08_exercist01 )全部内容,希望文章能够帮你解决Python:四位数字,每位相加和的函数 ( day08_exercist01 )所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1191640.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存