伟的博客 研发工程师

python求1980年到2029年众数和2010-01-07

2011-03-10

原创文章,转载时请注明地址:http://zwssd1980.blog.163.com/blog/static/30296492011210102033425/ http://zwssdzwssd.appspot.com/log/83.html python 求1980年到2029年众数和 注:还不能求所有数的众数和,慢慢完善。 # -- coding: utf-8 -- import strin myyear = str(1980) for j in range(50): zsh = int(myyear[0])+int(myyear[1])+int(myyear[2])+int(myyear[3]) if zsh>10: zsh = str(zsh) zsh = int(zsh[0])+int(zsh[1]) print ‘年份:’+myyear+’众数和是:’+str(zsh) myyear = int(myyear) myyear += 1 myyear = str(myyear)


Comments