得到数字中的数字之和 [英] getting the sum of digits in a number
本文介绍了得到数字中的数字之和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是这样的:
展开 | 选择 | Wrap | 行号
解决方案
我遇到的另一个小问题是我需要定义一个将我输入的数字分开并将它们加在一起的函数,例如:
123 - > 1 + 2 + 3 = 6
88 - > 8 + 8 = 16
感谢所有人的帮助,你真的在拯救我的生命!
< snip>以及我遇到的另一个小问题是我需要定义一个函数,它将我放入的数字拆分并将它们组合在一起,例如:
123 - > 1 + 2 + 3 = 6
88 - > 8 + 8 = 16
最后的事情(顺便说一下,我的dict函数有用吗?):展开 | 选择 | 换行 | 行号
i就像这样:展开 | 选择 | Wrap | 行号
i made it like this:
Expand|Select|Wrap|Line Numbers解决方案one other small problem i have is i need to define a function that takes the number i put in splits it up and adds them together for example:
123 --> 1+2+3=6
88 --> 8+8=16
thanks for all ur help guys u are really saving my life!
<snip>and one other small problem i have is i need to define a function that takes the number i put in splits it up and adds them together for example:
123 --> 1+2+3=6
88 --> 8+8=16
thanks for all ur help guys u are really saving my life!Last things first (by the way, where my dict functions helpful?):
Expand|Select|Wrap|Line Numbers
i made it like this:Expand|Select|Wrap|Line Numbers
这篇关于得到数字中的数字之和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆