crac

导航

no.5.print sum

#-*-coding=utf-8-*-
for a in range(1,50,1):
    for b in range(1,50,1):
        for c in range(1,50,1):
            if a+b+c==50:
                print a,b,c
                

 

如果是随机数咋整??:

test:

#-*-coding=utf-8-*-
import random
i=0  #计数
for a in range(1,50,1):
    for b in range(1,50,1):
        c=random.randint (1,50)
        if a+b+c==50:
            i+=1
            print a,b,c,i
                

 

posted on 2016-05-09 19:18  crac  阅读(208)  评论(0编辑  收藏  举报