Welcome to the Intro to Python exercise! This tutorial assumes only the ability to install software and read.
Please download Python (version 3.4.0 or higher) for your operating system from here.
AutomateTheBoringStuff has a great online booklet for learning the basics of Python. Read the following chapters:
Alice has three dogs. For each meal, Riley needs 50 pieces of dog food, Abby needs 100 pieces, and Luna needs 150 pieces. Write a function mealsLeft which takes the integer dogfood as the total remaining pieces of dog food. mealsLeft should return an integer telling how many "full meals" Alice can serve to her dogs.
Click To Open
- Consider how many total pieces it takes to feed all three dogs
- Use integer division to your advantage
- Write a function
howMuchDogFoodwhich takes an argumentmealsand returns how much dog food Alice should buy to have enough for that many meals - Set a price for dog food pieces. Rewrite the
howMuchDogFoodfunction to accept the argumentmoneyand return how much dog food Alice can afford