Computer Science, asked by buffalog421, 7 months ago

Write the function definition for given function call Boolean b=check ('m')

Answers

Answered by rameshbeniwal958
0

Answer:

I wish help you .

Explanation:

Let’s start by looking at an example that we used in a previous chapter: Mousetraps are sold online for 2.00 each plus .50 for shipping, with free shipping for orders of 30 or more. The logic that we used to calculate the shipping could be expressed like this (where num refers to the number ordered):

if num >= 30:

shipping_cost = 0

else:

shipping_cost = num * .50

Now suppose that shipping is also free for customers in zip code 50011. So before computing the shipping cost, we have to check the zip code. Assume that zip_code is a variable representing the zip code.

if num >= 30:

shipping_cost = 0

else:

if zip_code == 50010:

shipping_cost = 0;

else:

shipping_cost = num * .50

This makes sense, but doesn’t it seem a bit strange that the line ``shipping_cost = 0``appears in two places?

After all, there are only two possibilities, either the shipping cost is zero, or else it’s num times 50 cents. It seems like what we really want to say is something like this:

Similar questions