题目
PYTHON round
For
this problem,we'll round an int value up to the next multiple of 10 if
its rightmost digit is 5 or more,so 15 rounds up to 20.Alternately,
round down to the previous multiple of 10 if its rightmost digit is less
than 5,so 12 rounds down to 10.Given 3 ints,a b c,return the sum of
their rounded values.To avoid code repetition,write a separate helper
"def round10(num):" and call it 3 times.
Example Output:round_sum(16,17,18) → 60round_sum(12,13,14) → 30round_sum(6,4,4) → 10
For
this problem,we'll round an int value up to the next multiple of 10 if
its rightmost digit is 5 or more,so 15 rounds up to 20.Alternately,
round down to the previous multiple of 10 if its rightmost digit is less
than 5,so 12 rounds down to 10.Given 3 ints,a b c,return the sum of
their rounded values.To avoid code repetition,write a separate helper
"def round10(num):" and call it 3 times.
Example Output:round_sum(16,17,18) → 60round_sum(12,13,14) → 30round_sum(6,4,4) → 10
提问时间:2021-04-01
答案
$ pythonPython 2.7.3 (default, Jan 2 2013, 16:53:07) [GCC 4.7.2] on linux2Type "help", "copyright", "cre...
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
- 1当A大于0时,a分之|a|=_________________.当a小于0时,|a|分之a=_________________.
- 2金属生成氢气的质量与金属的相对原子质量及化合价来决定?
- 3英语字母大写i和小写L混淆?
- 4唐雎说信陵君中唐雎是怎样说服信陵君的?
- 5从1-----9,填写下列算式( )+ ( )=( ),( )—( )=( ),( )+( )=(
- 6He ______ when his teacher asked him to hand it in.
- 76-3(x-1)=12-2(2x+)
- 8life with和 have a life with中的life分别是什么词
- 9用30厘米长铁丝围成一个底边长8厘米的等腰三角形,这个等腰三角形一条腰长多少厘米?
- 105里面有()个4分之1
热门考点
- 1某课外小组用两个开关、一个电源、导线若干,将一个灯泡和一个电铃并联后接在电路中,当同时闭合两个开关,才能使灯泡发光,电铃发声;若只闭合其中某一个开关,灯泡不亮,电铃不
- 2已知幂函数Y=X^((m^2)-2m-3) (m∈N+)的图像与坐标轴不相交,且关于Y轴对称,则m=?
- 3已知(a+b)/(a-b)=3/2,求分式(a的平方-b的平方)/ab的值.
- 4清清嗓子 英语翻译
- 5求函数y=sin^2x/2-2的最小正周期
- 6钟表可以用来显示时间'用英语怎么说
- 7凸透镜所成的实像总是( ),凹透镜所成的虚像总是( )
- 8几个同学围着使用一台显微镜的时候,视野有时是黑暗的.造成视野黑暗的原因可能是什么?
- 9this is a pen改成一般疑问句
- 10刚体角加速度能否理解为刚体转角对时间的二阶导数