This short assignment has a lot of painful technical detail about installing the PyCharm software and using it. Future assignments will be more creative and will require less following of picky instructions.
Before we get to the fun stuff, you’ll need to read some things and install some software:
Familiarize yourself with the layout of the CS 1 web site. Most of the course materials will reside on the website, www.cs.dartmouth.edu/~devin/cs1.
Software. Install either the mac or windows course software on your computer. The software installation is tedious and tricky. If you have trouble, ask a question on Ed Discussion.
If PyCharm is not already running, launch it.
Just as you did when creating the cs1proj when you installed PyCharm, select Create New Project. You may enter whatever project name you like. I used SA1 by changing untitled to SA1. Make sure that you have the Python interpreter that you selected when you set up PyCharm.
I’m using a Mac. If you’re using Windows, it will be similar. Make sure to choose the Python interpreter that you set up when you installed PyCharm.
Remember how you were supposed to keep the file cs1lib.py that you downloaded nice and accessible? Find it, and copy it onto the name of your project in the Project tab. If you see a window that says These files do not belong to the project, just click OK.
Now you will type in a new program that you will write. This program prints your name with a simple text-based logo. First, click on SA1 (or your project name) in the Project tab. Then go to the File menu, choose New…, and then choose Python File. Type in the name of the file containing your Python program. Make sure that the name ends with .py. Then click OK. For example, I named my file logo.py.
The main part of the window will be a tab labeled with the name of your program (logo.py in our example). PyCharm puts in a line assigning the username of the author to the special variable __author__
. You can ignore this line; it won’t affect your program.
Write a Python program in logo.py that uses print statements to print out a logo containing your name. Hany Farid, who taught this course in a previous term, chose the following:
* ******
* *
* *
**********
* *
* *
* * Hany Farid
Run your program. Either your program will run correctly (writing to the console pane) or you will see an error message.
Your program might not run correctly the first time. If that’s the case, then you have had an early initiation into the world of programming. Errors are common in programming. We all make them. Even me. Fixing mistakes is a significant part of developing programs. If you have an error, check the syntax of your program carefully. Are the tabs, parentheses, colons, and quotation marks correctly placed? Did you misspell something?
When your program execution completes, you’ll be left with console pane containing the output of your program. We want to see the output of your program. Take a screenshot.
There are two things you need to turn in:
logo.py (or whatever you called the program you wrote to display your logo.)
logo_output.tiff or logo_output.bmp.
Please remember in all assignments that editing the output of the program before printing it is a violation of the Academic Honor Principle. Make sure that the output you turn in comes from the very same program that you turn in. If you make any change to the code, no matter how insignificant you think they might be, rerun your program to produce new output!
Submit the files through Canvas.
You are done. Whew! Future short assignments will have far fewer picky details. This one was really detailed because it’s your first time using PyCharm and your first time running and writing a Python program.
Keep up to date. Do your studying for each class—not just once a week. Do lots of simple exercises on your computer. Even when you think you understand how to do something, you will discover that it is still important to actually do it with your own fingers, on your own computer. Programming is not a spectator sport.