After completing this lab you should be set up with and understand how to make use of the programming and development tools we will be using. In particular:
Try to do as many of the exercises as possible, in the order listed. You may skip an exercise if it is impossible to accomplish the task described (for technical reasons). If you have trouble with an exercise, contact the instructor for help – do not just skip the exercise! You may work with a partner, but each of you must submit your individual work. Work should be done electronically on this document (cut and paste as needed but be careful of incorrect characters). Anything that involves code should be tried out in VS Code before submitting (you may cut and paste directly from VS Code). Submit work before the next class. If you cannot submit by this time, try to do so as soon as possible.
For exercises that do not ask specific questions but have you perform tasks, copy any code you created and the output as your answer to the exercise.
Using AI Assistance: Throughout this lab, you’re encouraged to use AI tools, especially GitHub Copilot Chat in VS Code, to help you understand commands, troubleshoot issues, and learn programming concepts. When you encounter problems or want to understand something better, try asking Copilot Chat specific questions about what you’re doing.
COPY this entire page and paste it, with your answers, into the Laulima assignment submission box for this assignment
If you have not installed the git tools or GitHub Desktop skip this exercise. Just create a folder on your desktop called ITM352_S26_repo
hello-world repo (that you created from the Hello World GitHub guide). Go to Settings and change the repo name to ITM352_S26_repo. Change the README.md if you wish. Also in the Settings page, go to the “Danger Zone” and change the repo “Make private” if it is not already set this way. Add the instructor and TA as contributors.What is the URL for your GitHub ITM352_S26_repo?
What is the path to the local ITM352_S26_repo?
Sometimes you will need to do more specific or detailed tasks that would be difficult or inconvenient to do through a GUI. A terminal window provides a command line interface to your operating system. There are many different types of shell environments such as sh, csh,bash, zsh,cmd, powershell that run in a terminal. These all have similar functionality and similar commands, but they may vary in the particular command language and syntax they use. You will find it very useful to be familiar with the basic shell commands. We will explore a few basic file system commands here needed for this class.
a) Open a terminal in VS Code (go to the Terminal menu -> New Terminal). Identify what shell is being used:
b) Try each of the commands below, copy the result you get and explain what the command does:
pwd
ls
mkdir newdir
cd new*
touch test
mv test test.txt
rm test.txt
echo hello > hello.txt
cat h*.txt
cd ..
rm -r newdir
history
NOTE: if a command doesn’t work for your particular shell, look up (or guess) what the command is supposed to do and then do a Google search to find out how to do it in your shell. You can also ask GitHub Copilot Chat: “Why doesn’t this command work in my shell?” or “What is the equivalent of [command] in [your shell type]?”
💡 AI Learning Tip: Try asking Copilot Chat to explain each command before you run it. For example: “What does the ‘pwd’ command do?” or “Explain what ‘mkdir’ does and why I would use it.”
c) Most shells support command history. What happens if you press the uparrow key? downarrow key?
d) Most shells support file name expansion. Try touch xxxx.txt then rm xx then hit the TAB key. What happened?
VS Code is a file editor designed to help build applications (code). Applications are built from files with instructions that the server and browser process. Let try making a simple “hello world” program and viewing it in a terminal.
💡 AI Learning Tip: As you work through this section, try asking GitHub Copilot Chat questions like: “What does print() do in Python?” or “Why do I need to save files before running them?” to deepen your understanding.
Lab1, create file in this folder <your Last_First name>_hello.py. Edit this file and put
print("Hello from <your first name>!")
Don’t forget to save this file after you make changes!
💡 AI Assistance: If you’re not sure how to create folders or files in VS Code, ask Copilot Chat: How do I create a new folder and file in VS Code? You could also use the Agent mode and ask Create a folder with name Lab1 then create file in this folder Port_Dan_hello.py
python <your Last_First name>_hello.py
Explain here why you see text in the terminal window. Where did this come from?
Explain why you see the code underlined in red and some messages in the PROBLEMS :
💡 AI Learning Tip: Ask Copilot Chat “Why does VS Code show red underlines in my code?” to understand how VS Code helps you find errors.
Click on the TERMINAL window and try executing the program again.
*Explain why you see the Hello from
💡 AI Debugging Help: If you get error messages you don’t understand, copy and paste the exact error into Copilot Chat with the question “What does this Python error mean and how do I fix it?”
-Put the closing quote mark back. In VS Code file manager right-click in explorer/finder, change the file extension from .py to .txt.
Explain why the color of the code changed and what you can do to get it back to what you saw previously
python <your Last_First name>_hello.txt
Explain why the code did not run and what you need to do to fix it
.pyExplain why you do get the Intellisense help for Python now
Now let’s explore using GitHub Copilot’s agent capabilities to help create a more sophisticated Python program.
In your Lab1 folder, we’ll use Copilot to create a new Python program. Open GitHub Copilot Chat in VS Code (Ctrl+Shift+I or Cmd+Shift+I).
Create a Python program called calculator.py that can perform basic math operations (add, subtract, multiply, divide). The program should ask the user to input two numbers and choose an operation, then display the result. Include error handling for division by zero.
calculator.py in your Lab1 folderCopy the code that Copilot generated for you here:
How should I test this calculator program to make sure it works correctly? Give me specific test cases to try.
Describe what test cases you tried and what results you got:
How can I make this calculator program better? Suggest one improvement and help me implement it.
What improvement did Copilot suggest and how did it help you implement it?
💡 Reflection Questions:
In the terminal window type the following:
python -i
Now try
print("hey! I'm using Python interactively")
You can quit interactive Python with
exit()
💡 AI Exploration: Try asking Copilot Chat “What can I do in Python interactive mode?” and experiment with some of the suggestions it gives you!
In GitHub Desktop view the changes made in you local repo. Commit and “push” these to your repository on GitHub. Go to github.com and verify your commits have been added.
Explain the benefits of working locally and pushing changes to a remote repository
💡 AI Understanding: Ask Copilot Chat “What is the difference between local and remote repositories?” and “Why is version control important for programming?” to better understand these concepts.
| ✅ | Ensure .py scripts are pushed and committed to repository |
| ✅ | Ensure all explanations are written in your own words, NOT copied verbatim from AI |
| ✅ | Ensure full comprehension of ALL code submitted |
| ✅ | Ensure Lab worksheet is completely filled out and submitted on Lamaku |
| ✅ | Ensure Lamaku assignments are submitted on time |