Description
Welcome!
Welcome to your first COMP 1510 lab. Today’s lab is all about setting up your toolchain, and using your
tools to generate a few simple and fun applications. You will install Python and PyCharm, and create your
first Python project.
If you’ve already done some or all of this, that’s great! Take this opportunity to work on the challenge
question at the end of this lab.
There will be twelve labs this term. You will have two hours to work on the lab on Monday. On Thursday
in lab, I will spend two minutes with each student in a lightning-round face to face marking meeting.
After a short break, we’ll spend some time reviewing important topics during the seminar, and finish with
our weekly quiz.
Take your time. Read each step. Don’t skip anything. Good luck, and have fun!
1 Grading
This lab and all future labs will be marked out of 5.
Figure 1: This lab is graded out of 5
For full marks this week, you must:
1. (1 point) Install Python 3 and the PyCharm IDE on your laptop
2. (1point) Write and execute an application that prints “Hello, world!” on the screen
3. (1 point) Write and execute an application that converts 10 degrees celsius to Fahrenheit and prints
both temperatures on the screen in a way that makes sense to the viewer
4. (1 point) Write and execute an application that prints a poem (see below) on the screen
5. (1 point) Correctly choose the valid and invalid assignment statements in step 17, and justify your
answers.
2 Requirements
Please complete the following:
1
1. Install Python 3.7.4, the latest version of Python. You can download Python 3 directly at https:
//www.python.org/downloads/. When asked to make a choice, install 64-bit Python, and make
sure you check YES in the little checkbox that asks whether you want to add Python to the PATH.
2. When installation is complete, ensure you can access Python 3 by using the commands python and
python3 on the command line (Windows) or Terminal (macOS). Which one works for you?
3. Open the Windows File Explorer (Windows) or Finder (macOS) and navigate to the folder where
Python was installed. Can you find it?
4. Sign up for a free renewable one-year JetBrains student license at https://www.jetbrains.com/
student/ so you can download and use any of the JetBrains desktop products.
5. Download and install the JetBrains Python IDE called PyCharm on your laptop. Visit https://www.
jetbrains.com/help/pycharm/install-and-set-up-pycharm.html#installation-requirements
for some helpful instructions.
6. When you start PyCharm for the first time, you will be asked to choose some settings. You can modify
any decisions you make, so don’t worry, you can’t break it.
7. PyCharm organizes our code into projects. Everything is done within the context of a project.
8. Create a new project called HelloWorld.
9. Python best practice is to create a virtualenv for each project, but we won’t do that in COMP 1510
because it’s only necessary for larger software projects. To avoid this, expand the Project Interpreter
node. Let’s choose Existing interpreter, and and specify the location of our Python installation.
Figure 2: Choose “Existing interpreter”
10. Check out the Code Tool Tips Window that PyCharm opens. These are useful. I strongly encourage
you to read each one.
2
11. Examine the files that are generated when we create this project. In the Project View (upper left
window) we can see the project files. There is a text editor window on the right, and a Tools Window
(hidden right now) at the bottom.
12. In the Project Windows in the upper left corner of PyCharm, right-click the little grey folder that has
your project name and choose New | Python file. Call it HelloWorld and press okay. PyCharm will
create the file and open it in the editor window.
13. Add some code to print Hello, world! to the screen.
14. Execute (run) the program by choosing Run/Run on the main menu. If a configuration window
pops up, click 1. HelloWorld. Check out the output that appears in the Run window at the bottom
of PyCharm. You can select configuration and play with the controls. You can’t break it!
15. Inside the same project, create a new file (program) called Temperature. Inside the Temperature
file, declare and initialize a variable to store a temperature in degrees celsius. Store 10 degrees
celsius. Use an expression and an assignment to convert this temperature to Fahrenheit and store it
in a new variable that stores temperatures in degrees Fahrenreit. Print the original and calculated
temperatures in a way that is easy for someone to read.
16. Create a new program (file) called Poem. Print the following message to the console (screen):
Roses are red
Violets are blue
Sugar is sweet
But I have commitment issues
So I’d rather just be friends
At this point in our relationship.
17. Which of the following assignments statements are valid?
x = 1
x = y
x = y + 2
x + 1 = 3
x + y = y + x
18. Bonus point: I like bonuses. I like encouraging you to work hard and do extra things that will make
you a better developer. To earn an extra point for this lab, add/commit this lab to a git repository on
your local machine (what we call your laptop), and then push it in a private repository on GitHub.
Let me know you’ve done this by inviting me on GitHub as a collaborator to your private repository.
On GitHub I am known as chris-thompson, and you will recognize me by my avatar.
That’s it! Good luck, and have fun!
3