Additional problems
Throughout this section, we are going to take a look at additional problems. For Problem 2, we will go right into the algorithm, as we went through the other steps in the problem earlier in this chapter. The next problem will have the entire computational thinking process as well.
Problem 2 - Children's soccer party
Earlier in this chapter, we were planning a party for a soccer team, where there was a cost of $12 per child. We stated that the number of children was unknown, so we will use the variable k to designate the unknown quantity. We also stated that we had a mathematical algorithm, T = 12k, that gave us the total cost, T, of k children. Let's add a condition here. If we had a budget of $200, we'd want to know if we are over, under, or right on that budget.
We can use Python to write an algorithm for this situation as well:
k = int(input("How many children are coming to the party? ")) T = 12 * k if T == 200: ...