The makeCatalog function that we create in this chapter has a couple of significant errors.
1. There should be a space in the title after the colon and before the product name. Fix that.
2. The grammar of the example is awful, because the product we provided is plural (“Seahorses”) but the text assumes a singular product. Fix it so that the text is right for the number of the input. There are several ways to fix this problem. One way is to take in a boolean input for singular or plural, then change the text accordingly. Another way is to create two catalog page generators, one for singular and one for plural, then let the user decide which to use. Implement one of these.
1. Pass in a boolean:
```
def makeCatalog(product, image, price, plural):
file = open(getMediaPath("catalog.html"), "wt")
body = ""
if not plural:
body = "
"
"+product+" is the greatest!
You are so lucky
to have found this page! You have the opportunity to buy "+product+" for the low, low
price of $"+str(price)+". Just take a look at this beauty!
100>
Get one today!
body > "else:
body = "
"
"+product+" are the greatest!
You are so
lucky to have found this page! You have the opportunity to buy "+product+" for the
low, low price of $"+str(price)+". Just take a look at these beauty!
Get some today!
body > "file.write(body)
file.close()
```
2. Split it into two generators:
```
def makeCatalogSingular(product, image, price, plural):
file = open(getMediaPath("catalog.html"), "wt")
body = "
"
"+product+" is the greatest!
You are so lucky
to have found this page! You have the opportunity to buy "+product+" for the low, low
price of $"+str(price)+". Just take a look at this beauty!
100>
Get one today!
body > "file.write(body)
file.close()
def makeCatalogPlural(product, image, price, plural):
file = open(getMediaPath("catalog.html"), "wt")
body = "
"
"+product+" are the greatest!
You are so lucky
to have found this page! You have the opportunity to buy "+product+" for the low, low
price of $"+str(price)+". Just take a look at these beauty!
100>
Get some today!
body > "file.write(body)
file.close()
```
You might also like to view...
Network data is often stored on a network ____________________, such as one that handles e-mail or movie downloads.
Fill in the blank(s) with the appropriate word(s).
When docking a panel group, the position the panel will take when you release the mouse button is called the dock zone.
Answer the following statement true (T) or false (F)
The bubble sort is the only sorting algorithm that exists.
Answer the following statement true (T) or false (F)
Match the following terms to their meanings:
I. Run time II. Design time III. Keyword IV. Syntax error V. MsgBox statement A. The code statement is identical in Access and Excel B. The mode during which a program is being executed C. Occurs when you misuse or misspell a keyword D. The mode for creating programming code E. Is grouped into different categories