Flint Marko

Generation

generate functionTue, 28 Mar 2023

Deseo tener 3 animales en un corral pero no quiero que se supere la cantidad de 500kg de comida a la semana, los animales son, oveja=80kg, caballo=200kg, vaca=225kg, pato=50kg, cerdo=150kg. El sistema deberá mostrar un mensaje indicando al usuario si se cumple o no la restricción

# An animal can carry a maxium of 500kgs of food per week # Animal weights sheep = 80 horse = 200 cow = 225 pig = 150 duck = 50 # If a want to have 3 animals in a corral, which animal should I choose? def food_restriction(animal_weight, max_food): if animal_weight > max_food: return False else: return True if food_restriction(sheep, 500): print("You can have a sheep in your corral") else: print("You can't have a sheep in your corral") if food_restriction(horse, 500): print("You can have a horse in your corral") else: print("You can't have a horse in your corral") if food_restriction(cow, 500): print("You can have a cow in your corral") else: print("You can't have a cow in your corral") if food_restriction(

Questions about programming?Chat with your personal AI assistant