Identifying prices
After you showed your report to your boss, he came up with the idea of offering courses to the company's users on some of the tools you studied. In order to make a pilot test, you will send an email offering a course about one of the tools, randomly chosen from your dataset. You also mention that the estimated fee needs to be paid on a monthly basis.
For writing the email, you will use Template strings. You remember that you need to be careful when you use the dollar sign since it is used for identifiers in this case.
For this example, the list tools contains the corresponding tool name, fee and payment type for the product offer. If you want to explore the variable, you can use print() to view it in the IPython Shell.
Diese Übung ist Teil des Kurses
Regular Expressions in Python
Anleitung zur Übung
- Assign the first, second, and third element of
toolsto the variablesour_tool,our_feeandour_payrespectively. - Complete the template string using
$tool,$fee, and$payas identifiers. Add the dollar sign before the$feeidentifier and add the characterslydirectly after the$payidentifier. - Substitute identifiers with the three variables you created and print out the results.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Import template
from string import Template
# Select variables
our_tool = ____
our_fee = ____
our_pay = ____
# Create template
course = ____("We are offering a 3-month beginner course on ____ just for ____ ____ ____")
# Substitute identifiers with three variables
print(____.____(____=____, ____=____, ____=____))