Allen Chen

Generation

generate functionSun, 02 Apr 2023

you are helping an army. if you don't send supplies, you would die. if the food drops to 0 all would die. if you run out of iron, the army could not fight. you will start with 100 food and 100 iron. it takes 10 seconds to produce 1 food and 100 seconds to produce 1 iron.

food = 100 iron = 100 def food_per_second(time): return time / 10 def iron_per_second(time): return time / 100 def food_iron_counter(time): global food global iron food = food - food_per_second(time) iron = iron - iron_per_second(time) return food, iron food_iron_counter(10)

Questions about programming?Chat with your personal AI assistant