百钱买百鸡:公鸡5元一只,母鸡3元一只,小鸡0.5元一只,100块钱买100只鸡问:应该买多少只公鸡母鸡和小鸡,一共有几种买法设:公鸡为x只,母鸡为y只,小鸡为z只 x = 0 while x y = 0 while y z = 0 while z if x + y + z == 100 and 5 * x +3 * y +0.5 * z == 100: print(x,y,z) z += 1 y += 1 x += 1 下图为以上代码运行结果:文章为博为峰网校(www.atstudy.com)原创文章