Skip to content

Commit e8e7589

Browse files
authored
Merge branch 'main' into kelin-lab00-getting-started
2 parents cf2ea53 + 10f77a7 commit e8e7589

24 files changed

+550
-22
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Ignore any user's VSCode workspace file
2+
*code-workspace
3+
14
# Created by https://www.toptal.com/developers/gitignore/api/python,windows,macos
25
# Edit at https://www.toptal.com/developers/gitignore?templates=python,windows,macos
36

0 General/00 Getting Started.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
* NOTE: When some text below is placed between `<` and `>`, that means the user should provide their own text in the command and the user should not include the `<` and `>`.
1010

11+
* To follow the guide, keep the two points in mind:
12+
* At each "**Execute the following commmand**" statement below, Type the command into your CLI and press enter.
13+
* Replace any part of the command within the `<` and `>` with your specific text.
14+
* The statement folling the "Sample command and output" statement is just an example of what the CLI might display on the line you execute the command and the following lines which display the reponse output of your command.
15+
1116

1217
1. Open CLI.
1318

14-
1. Make sure we are in correct folder (directory). We should be inside <class_name> folder (directory). `pwd` shows the current 'working directory':
19+
1. Make sure we are in correct folder (directory). We should be inside <class_name> folder (directory). `pwd` shows the current 'working directory'. **Execute the following commmand**:
1520
```
1621
pwd
1722
```
@@ -26,7 +31,7 @@
2631
PS C:\Users\Bruce\Programming\class_name>
2732
```
2833
29-
1. Verify we are in a directory that is a git repository:
34+
1. Verify we are in a directory that is a git repository. **Execute the following commmand**:
3035
```
3136
git status
3237
```
@@ -46,7 +51,7 @@
4651
* lab-name: `getting-started`
4752
* My name is 'Bruce' so my branch name would be `bruce-lab00-getting-started`.
4853
* The command we will use (where `<branch-name>` is replaced by your branch name decided above):
49-
* This command creates a new branch named `<branch-name>` from the current state of the `main` branch.
54+
* This command creates a new branch named `<branch-name>` from the current state of the `main` branch. **Execute the following commmand**:
5055
```
5156
git checkout -b <branch-name>
5257
```
@@ -57,7 +62,7 @@
5762
PS C:\Users\Bruce\Programming\class_name>
5863
```
5964
60-
1. We can verify current git branch and list local branches using `git branch`:
65+
1. We can verify current git branch and list local branches using `git branch`. **Execute the following commmand**:
6166
```
6267
git branch
6368
```
@@ -70,7 +75,7 @@
7075
PS C:\Users\Bruce\Programming\class_name>
7176
```
7277
73-
1. Verify contents of current directory:
78+
1. Verify contents of current directory. **Execute the following commmand**:
7479
```
7580
ls
7681
```
@@ -89,7 +94,7 @@
8994
9095
PS C:\Users\Bruce\Programming\class_name>
9196
```
92-
1. Change directory (folder) into the `code` directory:
97+
1. Change directory (folder) into the `code` directory. **Execute the following commmand**:
9398
```
9499
cd code
95100
```
@@ -99,7 +104,7 @@
99104
PS C:\Users\Bruce\Programming\class_name\code>
100105
```
101106
102-
1. Verify we are in `code` directory:
107+
1. Verify we are in `code` directory. **Execute the following commmand**:
103108
```
104109
pwd
105110
```
@@ -114,7 +119,7 @@
114119
PS C:\Users\Bruce\Programming\class_name\code>
115120
```
116121
117-
1. Create your directory inside the `code` directory. Use the lowercase version or your name:
122+
1. Create your directory inside the `code` directory. Use the lowercase version or your name. **Execute the following commmand**:
118123
```
119124
mkdir <studentdirectoryname>
120125
```
@@ -132,7 +137,7 @@
132137
PS C:\Users\Bruce\Programming\class_name\code>
133138
```
134139
135-
1. Change directory into your personal directory:
140+
1. Change directory into your personal directory. **Execute the following commmand**:
136141
```
137142
cd <studentdirectoryname>
138143
```
@@ -147,7 +152,7 @@
147152
* This markdown file named `README.md` will hold your name, your directory name, and your GitHub username.
148153
* You can also add any other information or links to the file later if you choose.
149154
* The '#' below will make that line render as a heading in the markdown file.
150-
* We will use something like this, where `Firstname Lastname` is replaced by your first and last name:
155+
* We will use something like this, where `Firstname Lastname` is replaced by your first and last name. **Execute the following commmand**:
151156
```
152157
echo "# Firstname Lastname" > README.md
153158
```
@@ -171,7 +176,7 @@
171176
brucestull
172177
```
173178
174-
1. Use `git status` to get the status of our branch:
179+
1. Use `git status` to get the status of our branch. **Execute the following commmand**:
175180
```
176181
git status
177182
```
@@ -186,8 +191,20 @@
186191
nothing added to commit but untracked files present (use "git add" to track)
187192
PS C:\Users\Bruce\Programming\class_name\code\bruce>
188193
```
194+
* Sample command and output:
195+
```
196+
PS C:\Users\Bruce\Programming\class_HB2\code\bruce> git status
197+
On branch bruce-lab00-getting-started
198+
Changes not staged for commit:
199+
(use "git add <file>..." to update what will be committed)
200+
(use "git restore <file>..." to discard changes in working directory)
201+
modified: README.md
202+
203+
no changes added to commit (use "git add" and/or "git commit -a")
204+
PS C:\Users\Bruce\Programming\class_HB2\code\bruce>
205+
```
189206
190-
1. Let's now add the files and directories we created to be tracked by git:
207+
1. Let's now add the files and directories we created to be tracked by git. **Execute the following commmand**:
191208
```
192209
git add -A
193210
```
@@ -206,7 +223,7 @@
206223
git add <directorypath>
207224
```
208225
209-
1. Let's use `git status` again to verify we are tracking the proper files:
226+
1. Let's use `git status` again to verify we are tracking the proper files. **Execute the following commmand**:
210227
```
211228
git status
212229
```
@@ -224,7 +241,7 @@
224241
1. We can now `commit` our changes to the branch `<studentname-labnumber-lab-name>` git history.
225242
* The `<commit message>` below is used to describe the changes this commit includes.
226243
* The `<commit message>` may be something like "Added directory for storing labs and included personal README.md"
227-
* We will use the command `git commit -m "<commit message>"`:
244+
* We will use the command `git commit -m "<commit message>"`. **Execute the following commmand**:
228245
```
229246
git commit -m "<commit message>"
230247
```
@@ -237,7 +254,7 @@
237254
PS C:\Users\Bruce\Programming\class_name\code\bruce>
238255
```
239256
240-
1. Finally we can push our code to remote repository hosted on Github. This will allow the instructor and TAs to see the code changes and grade the labs:
257+
1. Finally we can push our code to remote repository hosted on Github. This will allow the instructor and TAs to see the code changes and grade the labs. **Execute the following commmand**:
241258
```
242259
git push origin <branch-name>
243260
```
@@ -253,9 +270,9 @@
253270
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
254271
remote:
255272
remote: Create a pull request for 'bruce-lab00-getting-started' on GitHub by visiting:
256-
remote: https://github.com/PdxCodeGuild/class_062722/pull/new/bruce-lab00-getting-started
273+
remote: https://github.com/PdxCodeGuild/class_HB2/pull/new/bruce-lab00-getting-started
257274
remote:
258-
To https://github.com/PdxCodeGuild/class_062722.git
275+
To https://github.com/PdxCodeGuild/class_HB2.git
259276
* [new branch] bruce-lab00-getting-started -> bruce-lab00-getting-started
260277
PS C:\Users\Bruce\Programming\class_name\code\bruce>
261278
```

0 General/10 GitHub Pull Request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
1. TAs will review pull request and evaluate the lab.
3434

3535
* Example pull request for `brucestull`:
36-
* [#3](https://github.com/PdxCodeGuild/class_062722/pull/3)
36+
* [#3](https://github.com/PdxCodeGuild/class_HB2/pull/3)

0 General/11 Git Lab Workflow.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,76 @@
55
* Replace the `<new-branch-name>` items below with your appropriate formed `<studentdirectoryname-labnumber-lab-name>` branch name.
66
* An example `<new-branch-name>` would be `bruce-lab01-python-exercise`
77

8+
1. It's good practice to get the current git status to see what branch is current, what files have been changed, and other details:
9+
`git status`
10+
11+
1. Reminder, git branch can be used to see our current branch and other available local branches:
12+
`git branch`
13+
814
1. Checkout the `main` branch since we want to keep it syncronized with remote:
915
`git checkout main`
16+
1017
1. Retrieve the remote changes to `main` branch and sync them to local repository:
1118
`git pull origin main`
19+
1220
1. Create a new branch `<new-branch-name>` from current state of `main` branch:
1321
`git checkout -b <new-branch-name>`
22+
1423
1. Do some code changes.
24+
1525
1. Add all the changes made to git tracking (or add only `<filename>` or `<directoryname>` changes):
1626
`git add -A`
27+
1728
1. Commit the changes made to the branch:
1829
`git commit -m <commit message>`
30+
1931
1. Push local changes to branch `<new-branch-name>` to the remote repository `origin`:
2032
`git push origin <new-branch-name>`
33+
2134
1. Do some more code changes.
35+
2236
1. Add all the changes made to git tracking:
2337
`git add -A`
38+
2439
1. Commit the changes made to the branch:
2540
`git commit -m <commit message>`
41+
2642
1. Push local changes to branch `<new-branch-name>` to the remote repository `origin`:
2743
`git push origin <new-branch-name>`
28-
1. When lab is completed, create pull request on GitHub.
44+
45+
1. When lab is completed, [create pull request on GitHub](10%20GitHub%20Pull%20Request.md).
46+
47+
1. After lab has been graded and pull request approved, perform the following two commands to remove the reference to the remote branch, and then delete your local branch:
48+
1. `git remote update origin --prune`
49+
1. `git branch -d <graded-and-merged-branch-name>`
50+
2951
1. Repeat process for new labs.
3052

3153
## Use the following to switch between multiple in-process lab branches.
3254

3355
1. Git `add` and `commit` changes to current branch:
3456
1. `git add -A`
3557
1. `git commit -m <commit message>`
36-
1. Checkout the branch we want to work on:
58+
59+
1. Checkout the different branch we want to work on:
3760
* `git checkout <a-branch-name>`
61+
3862
1. Do the code changes for this branch.
63+
3964
1. Git `add` and `commit` changes to the new current branch `<a-branch-name>`:
4065
1. `git add -A`
4166
1. `git commit -m <commit message>`
67+
4268
1. Checkout some other branch we want to work on:
4369
* `git checkout <some-other-branch-name>`
70+
4471
1. Repeat process as needed.
4572

4673
## Use the following to delete branches for labs which have already been graded.
4774
* NOTE: We delete the branches after they have been merged into `main` since the work has been completed and all the changes have been recorded in the `commit`s. We no longer need the branches.
4875

4976
1. Sync our local record of remote branches. This will remove local references to branches which have been deleted on remote:
5077
* `git remote update origin --prune`
78+
5179
1. Delete the local copy of the branch:
5280
* `git branch -d <lab-branch-which-has-been-graded>`

1 Python/labs/00 Average Numbers renamed to 1 Python/labs/01 Average Numbers

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Lab 2: Average Numbers
1+
Lab 01: Average Numbers
22

33
We're going to average a list of numbers. Start with the following list, iterate through it, keeping a 'running sum', then divide that sum by the number of elements in that list. Remember len will give you the length of a list.
44

1 Python/labs/02 Unit Converter

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Lab 02: Unit Converter
2+
This lab will involve writing a program that allows the user to convert a number between units.
3+
4+
Version 1
5+
Ask the user for the number of feet, and print out the equivalent distance in meters. Hint: 1 ft is 0.3048 m. So we can get the output in meters by multiplying the input distance by 0.3048. Below is some sample input/output.
6+
7+
> what is the distance in feet? 12
8+
> 12 ft is 3.6576 m
9+
Version 2
10+
Allow the user to also enter the units. Then depending on the units, convert the distance into meters. The units we'll allow are feet, miles, meters, and kilometers.
11+
12+
1 ft is 0.3048 m
13+
1 mi is 1609.34 m
14+
1 m is 1 m
15+
1 km is 1000 m
16+
Below is some sample input/output:
17+
18+
> what is the distance? 100
19+
> what are the units? mi
20+
> 100 mi is 160934 m
21+
Version 3
22+
Add support for yards, and inches.
23+
24+
1 yard is 0.9144 m
25+
1 inch is 0.0254 m
26+
Version 4 - optional
27+
Now we'll ask the user for the distance, the starting units, and the units to convert to.
28+
29+
You can think of the values for the conversions as elements in a matrix, where the rows will be the units you're converting from, and the columns will be the units you're converting to. Along the horizontal, the values will be 1 (1 meter is 1 meter, 1 foot is 1 foot, etc).
30+
31+
ft mi m km
32+
ft 1 0.3048
33+
mi 1 1609.34
34+
m 1/0.3048 1/1609.34 1 1/1000
35+
km 1000 1
36+
But instead of filling out that matrix, and checking for each pair of units (if from_units == 'mi' and to_units == 'km'), we can just convert any unit to meters, then convert the distance in meters to any other unit.
37+
38+
Furthermore you can convert them from meters by dividing a distance (in meters) by those same values used above. So first convert from the input units to meters, then convert from meters to the output units.
39+
40+
Below is some sample input/output:
41+
42+
> what is the distance? 100
43+
> what are the input units? ft
44+
> what are the output units? mi
45+
100 ft is 0.0189394 mi
46+
Turning in your lab
47+
Make sure you are still on your lab branch with git status. This will also show you a list of files that have been modified.
48+
Add any files you want git to keep track of using git add filename. Replace filename with the name of your file. You can also use git add . to add everything within the current folder.
49+
Commit your work using git commit -m "Your commit message". Make sure your commit message is descriptive and describes what has been changed during this commit.
50+
Finally we can run the command git push to send our files up to Github. This may throw an error, but worry not, there will be a suggested command to run, simply copy and paste that command and you should be good to go.
51+
Don't forget to visit Github and create a pull request to submit your work for review.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Presentation Day: November 4th, 2022
2929

3030
| Lab | Name | Date Assigned | Due By Start Of Class | Hard Due Date |
3131
| --- | ---------------------- | ------------- | --------------------- | ------------- |
32-
| 01 | Lab | 00 Jun | 00 Jun | 00 Jun |
32+
| 01 | Lab Average Numbers | 28 Jun | 05 Jul | 12 Jul |
3333
| 02 | Lab | 00 Jun | 00 Jun | 00 Jun |
3434
| 03 | Lab | 00 Jun | 00 Jun | 00 Jun |
3535
| 04 | Lab | 00 Jun | 00 Jun | 00 Jun |

code/Andy/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Andy Roblero
2+
Directory Name:
3+
Andy
4+
5+
Github Username:
6+
andy2124

0 commit comments

Comments
 (0)