今天我们来用python3.7编写一个程序来帮助我们完成鸡兔同笼的问题,话不多说,直接来编程: feet1 = 0 feet2 = 0 head = 0 rabbits = 0 chickens = 0 head = int(input('鸡兔同笼问题,请输入只数:')) feet1 = int(input('请输入腿数:')) #假设都是兔子,那么有 只数 X 4 条腿 feet2 = head * 4 feet2 = feet2 - feet1 #多出来的腿是鸡的 chickens = feet2 / 2 rabbits = head - chickens print(str(rabbit