Hello World
Due: Wednesday, September 11th at 11:59PM
Where: Complete on Codio, Submit on Gradescope
1. Getting Started
Goals
The purpose of this assignment is to introduce you to coding in Python and familiarize you with the mechanics of preparing and submitting assignments. The specific goals are to:
- Familiarize yourself with the course website
- Sign up for Ed (our class discussion board)
- Learn to use Codio for editing, compiling, and executing programs
- Edit, compile, and execute a simple Python program
- Learn your way around Gradescope (our online submission and grading site)
Preface
If you find yourself needing help with this or any other assignment, please refer to our getting help page for the resources we have available.
Ed Discussion
The class discussion board is hosted on Ed. You should be automatically enrolled in the Ed course. Please contact one of the Head TAs if you are not.
Use Ed to:
- View all course announcements from the instructor
- Ask all questions about course logistics or material
- You may post about errors in your code, but these issues are best addressed in office hours
- If your question is very specific to your code, post privately (just to TAs and instructor) to protect the privacy of your code
- Answer other students’ questions
- Follow questions asked by other students (this may help answer questions you have too)
Software Setup
We will be using Codio this semester - enroll in the Codio course by clicking the link at the course website.
2. Hello, World!
Program Overview and Setup
This part of the homework walks you through completing your first program! Traditionally, the first program anyone writes in a new language just prints, “Hello, World!” to the interactions pane.
-
Once you’ve logged in to Codio, click Courses on the left and navigate to this class. Go to the “My Classroom” tab and select the assignment with the name “Hello, World!”
-
On the left, you should see a pane with a list of files. Open the
hello_world.py
file. You should update the name and PennKey at the top of the file. Type the following code, do not copy and paste it where you see the TO-DO comment, just for practice (it won’t take long). If you omit even a single quotation mark, the program won’t work, so pay attention.print("Hello, world!")
- Click the Run button in Codio’s dropdown (on the top) to execute your program. If you have any errors, you may get an error! You will see the error message in the new terminal window that Codio opens for you. The message will likely be difficult to understand at this stage, but it will tell you exactly which line of code is giving you a problem and preventing compilation. Make sure you typed in exactly the program provided above.
- If the program is written correctly, it should print out,
Hello, World!
in the terminal window.
3. Example Drawing
For CIS 1100, we will be using a drawing library that we have called PennDraw
. Before you make your own drawing, you will study our example drawing of a house to understand how the PennDraw
library works.
To do this part of your HW:
- Click
Run MyHouse
in the Codio dropdown. - Click View Running Program next to
Run MyHouse
. - You should see a drawing appear in a new window. If so, close the window and continue with the assignment. If not, we’ll be happy to help you.
We have provided you with example code in my_house.py
to make sure that drawing is working on your computer. It also gives you some examples of what can be drawn using the PennDraw library. Read the PennDraw documentation to see what you can draw (i.e. shapes, images, text…) using PennDraw. The documentation page lists all of the functions you can use and explains how to use them.
Open the file my_house.py
in Codio. Ensure that the provided code runs! Pay attention to the comments in the code (the text that begins with #
and appears in grey) as they will help you understand what each line of code contributes to the drawing you see.
4. Your Own Drawing
You will now write your own program which will create a drawing (like the one you saw in my_house.py
).
My Sketch Specifications
Find the file my_sketch.py
in Codio. Use your hello_world.py
and my_house.py
programs to guide you in writing this new program. Design and create your own piece of digital art using Python and the PennDraw
library. Think of yourself as a creative designer when choosing the topic of your design.
This is your very first program, so here are some guidelines:
- Make a header section with your name, pennkey etc similar to what you have done in
hello_world.py
. - To begin writing actual code (rather than comments), refer to your
hello_world.py
andmy_house.py
programs - Make sure that it is at least 500 pixels by 500 pixels. The dimensions can vary depending upon your design, but make sure that it is not “small”.
- Make use of any of the drawing functions learned in class examples:
pd.set_canvas_size()
,pd.rectangle()
,pd.filled_rectangle()
etc. - You are also encouraged to use any of the drawing functions that you find on the PennDraw documentation.
- Your sketch should make use of several functions. A really “abstract” sketch like a simple circle in the center of the screen will not suffice, as aesthetic as it may seem.
- Build your program up slowly, running and testing (making sure it draws what you think it should) frequently as you go.
- Start by adding a few simple shapes to your sketch. Then test your program. Then change the colors. Then test it. Then add some more, and test it. Repeat this process, building your program up step-by-step.
- At each point in time, you should have a completely working program. If you made a small change and broke something, then most likely the problem is in what you just changed. This makes debugging faster and easier.
- Trying to write a bunch of code and then debugging it all at once will result in frustration and a program that is difficult to get working.
- Be creative. Have fun and experiment!
- (This is not an assessment of artistic ability so don’t worry if art is not your strong suit! Just give it your best effort)
Here are some ideas to get you started:
- A self-portrait
- An avatar or a cartoon of someone
- Your favorite cartoon TV Show character, or design your own…
- A city-scape
- Animal/object caricatures
- A selection from Sistine chapel (just kidding…)
Readme
Every assignment will have an accompanying readme
file that you will fill out and submit. This is a required part of the assignment and it usually takes only a few minutes. Among other things, the readme is where you can give any comments or feedback you have on the homework.
- In Codio, select
readme_hello.txt
on the left. - Complete all questions in
readme_hello.txt
and save the file. You will submit it with everything else in the next step.
Submission
All homework will be submitted to Gradescope. You should be already enrolled in Gradescope through Canvas. If you don’t know your login details, go to the Canvas course and click on Gradescope. This should prompt you to create an account linked to your Penn email and you’re all set up to submit. Complete the following steps to submit your HW0 assignment:
- On Codio, to download
hello_world.py
,my_sketch.py
, andreadme_hello.txt
for submission, right click on the file names and selecting “Download”. - On Gradescope, under the “Assignments” tab for CIS 1100 (on the left of your window), select HW0.
- Upload
hello_world.py
,my_sketch.py
, andreadme_hello.txt
. - Click “Submit” to submit your homework.
- All program file names should match the required names exactly, including capitalization.. Python is extremely picky about file names and capitalization; if your file name doesn’t match what we expect, your program will probably fail our automated tests. You can always re-submit to correct such errors.
- The confirmation page shows you the recorded submission time, which files have just been uploaded, which were previously uploaded, and which have not yet been submitted.
- Read the Test Output section carefully. We show you the results of a variety of automatic tests on every homework. Each homework will describe the tests it runs. Usually, we will show you the output of running your program (if there is any), a few simple tests, and the results of checkstyle.
- The tests we run on your submission are not complete, and do not guarantee your program works perfectly. On some homework assignments, we only show you whether your code compiles and if you have style errors.
- Checkstyle automatically checks your program for conformity to many aspects of our coding style guidelines. It is not exhaustive, meaning that you could receive point deductions for style issues not caught by our style checker. See the “Coding Style” section of the policies for more information.
- All homework must be submitted through Gradescope. We only accept emailed submissions if Gradescope is down, which is very rare. If you are having issues using Gradescope, visit Office Hours or post on Ed.
- If you used images in any of your programs, you’ll need to submit those image files as well in order for your program to run correctly. For your submission it does not matter what your image files are named, however, the image names that you choose must match those found in your code (i.e. if you call
pd.picture(0, 0, "cloud.png")
, you must include in your submission an image titledcloud.png
).