If the version of your code on github does not run, it is considered non-functioning. If it does not run on your personal computer WITHOUT CHANGES, it is considered non-functiong.
WARNING: Graders will not grade any part of your code that does not execute.
TOTAL: 10 points
README.md
file updated (2 points)main.py
prints student’s name (3 points)In this lab, you will learn to:
For this lab and future labs, we will be using a set of tools for storing, writing, running, and testing small programs.
Your code will be stored on Github, and you can work on it anywhere (your own machine, online, lab machines ). Any time you wish to make a commit (snapshot) of your code, push it back to Github, then continue working.
If you have not done so already, review the Course Tools exercise from Ch 00 to set up your portfolio.
For this course, you will need to learn to use the command line.
If you are working on the CS Remote/Lab computers:
*If you are working in a local environment: *
You enter commands at the blinking cursor. Notice the prompt (the text before what you’re typing) states what folder you are working in. Instead of using a mouse to point and click on folders, you will use text commands to navigate through the same folders.
A few useful commands when working in a shell environment:
pwd
: print my current working directory branchls
: print a list of files and folders in the current working directorycd
: change directory
cd <folder>/<subfolder>
cd ..
touch
: create a blank file
touch main.py
From your portfolio root, you can navigate to folders in your portfolio with:
cd ch<##>/<folder>
<##>
with the chapter number<folder>
with the folder nameBefore moving on to Part B, make sure you can do the following in the shell:
lab
in ch00
of your portfolio.ch00
lab
folder:
touch example.py
IMPORTANT CONCEPT: The shell is a different interface for navigating the same file system. Anything you access on the terminal (text based interface) can also be accessed through the GUI (point and click based interface).
HINT
You can cycle through previous commands with your ⇧
. This way you do not have to keep typing in the same commands to run your code.
Respositories usually come with a file called a README.md
in the root directory. The README.md
contains information about the respository and uses a simplified form of html
called markdown.
You will need to edit your README.md
file to include your Name, Discord username, Github username
There is a main.py
inside of your ‘ch00/lab’ folder. First, you are going to run this file to ensure that the environment is working and setup properly. In the shell, from your portfolio, navigate to your lab folder:
cd ch00/lab
The run the code for this lab:
python3 main.py
If you get an import
error, enter the following command in the shell:
pip3 install -r requirements.txt
If you have any problems, ask one of us for help.
Once your environment is working and you can successfully run the main.py
file in your lab folder, change the line (24):
text = font.render("Hello, World", True, "black")
to
text = font.render("Hello <first name>", True, "<color>")
<first name>
with your first name<color>
with a color of your choosingFor example, I would change it to: text = font.render("Hello Steven", True, "pink")
_
Run the code to make sure it works.*
If you run into issues getting your environment set up, don't worry. This lab (and only this lab) does not have any penalty for late submissions. We will work with you to get your environment up and running.
Every lab will have required submission guidelines. Please read submission requirements carefully. Any deviations from specifications on future labs or projects will result in significant point deductions or incomplete grades.
Now that we have made changes to our portfolio, we need to commit those changes back to Github.
*If you are using VS Code, *they have a great tutorial on using VSCode with git and Github:
https://code.visualstudio.com/docs/sourcecontrol/overview
If you are working in a shell (IDLE, remote, terminal, etc), use the following git
commands:
MAKE SURE YOU ARE IN AN OS SHELL such as terminal or git-bash. The Python shell only executes Python commands, and you will get an error if you enter any of the commands below there.
git add .
git commit -am "my commit message"
git push
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream upstream main
--set-upstream origin main
after git push
. You only need to do this once.That's it! We've completed our work for this lab. We will use this submission process for all subsequent labs and assignments.