First Programs: Using Variables
- Open PyCharm, and create a new project called “FirstPrograms”.
- Right-click and create a new python file called
hello_me.py
- Double-click the file to open it.
- Edit the file:
- Create a variable to store your first name
- Print “Hello, my name is …” and replace the ellipsis (…) with the variable that is storing your first name.
- Add a comment at the top of the file that explains what your program does.
- Run your python program.
- Create a second program called
tips.py
, that:
- Has 4 variables:
- meal: holds the value of the meal ($53.48)
- tax: holds the tax percentage (7%)
- tip: holds the tip percentage (18%)
- total: holds the total of the meal. Proper tipping technique dictates that the tip should be calculated based on the total cost of the meal, before tax is applied.
- Prints the contents of the total variable with a leading dollar sign ($).
- Run your tips program. The total should be
$66.85