其他一切都很好,但除了两个
People = input("Number of people: ")
Cookie = input("Numnber of cookies: ")
People = int(People)
Answer = int(Cookie) / int(People)
Remain = int(Cookie) % int(People)
print ("Cookies per person: ", Answer)
print ("Cookies returning to the jar: ", Remain)
使用两个变量 4(people) 和 11(cookies) 运行代码会返回:
Number of people: 4
Number of cookies: 11
Cookies per person: 2.75
Cookies returning to the jar: 3
如何将 2.75 更改为 2?
蟒蛇 3.3