UNCLASSIFIED

Skip to content
Snippets Groups Projects
Commit 360c735d authored by kmc-home's avatar kmc-home
Browse files

update lab

parent 879b62e9
Branches
No related merge requests found
Pipeline #120295 passed with stage
in 12 seconds
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="84"
height="84"
version="1.1"
id="svg42"
sodipodi:docname="5 by 5 orthogonal maze.svg"
inkscape:version="0.92.4 (f8dce91, 2019-08-02)">
<metadata
id="metadata48">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs46" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1850"
inkscape:window-height="911"
id="namedview44"
showgrid="false"
inkscape:zoom="6.619101"
inkscape:cx="46.640642"
inkscape:cy="32.812069"
inkscape:window-x="70"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg42" />
<title
id="title2">5 by 5 orthogonal maze</title>
<desc
id="desc4">5 by 5 orthogonal maze generated by The Maze Generator Website (http://www.mazegenerator.net/).</desc>
<line
style="fill:none;stroke:#000000;stroke-width:1.99999988;stroke-linecap:square"
id="line6"
y2="1.9999999"
x2="80.896736"
y1="1.9999999"
x1="2.8967924" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line10"
y2="18"
x2="66"
y1="18"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line18"
y2="66"
x2="50"
y1="66"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line20"
y2="82"
x2="34"
y1="82"
x1="2" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line22"
y2="82"
x2="82"
y1="82"
x1="50" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line24"
y2="82"
x2="2"
y1="2"
x1="2" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line26"
y2="34"
x2="18"
y1="18"
x1="18" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line30"
y2="50"
x2="34"
y1="34"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line34"
y2="82"
x2="50"
y1="66"
x1="50" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line36"
y2="66"
x2="66"
y1="50"
x1="66" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line38"
y2="82"
x2="82"
y1="2"
x1="82" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line18-4"
y2="50"
x2="50"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line18-4-7"
y2="34"
x2="66"
y1="34"
x1="50" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line18-4-7-2"
y2="34"
x2="34"
y1="34"
x1="18" />
<g
id="g3740">
<circle
r="5"
cy="73.337151"
cx="9.9078016"
id="path4627"
style="fill:#999999;stroke:none;stroke-width:1.99999988;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1" />
<text
id="text94"
y="76.117149"
x="9.962677"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="76.117149"
x="9.962677"
id="tspan92"
sodipodi:role="line">$</tspan></text>
</g>
<g
transform="translate(31.940781,-15.624708)"
id="g3740-8">
<circle
r="5"
cy="73.337151"
cx="9.9078016"
id="path4627-9"
style="fill:#999999;stroke:none;stroke-width:1.99999988;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1" />
<text
id="text94-0"
y="76.117149"
x="9.962677"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="76.117149"
x="9.962677"
id="tspan92-6"
sodipodi:role="line">$</tspan></text>
</g>
<g
transform="translate(16.228678,-47.804305)"
id="g3740-87">
<circle
r="5"
cy="73.337151"
cx="9.9078016"
id="path4627-90"
style="fill:#999999;stroke:none;stroke-width:1.99999988;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1" />
<text
id="text94-3"
y="76.117149"
x="9.962677"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="76.117149"
x="9.962677"
id="tspan92-3"
sodipodi:role="line">$</tspan></text>
</g>
<g
transform="translate(48.559352,-31.336811)"
id="g3740-87-3">
<circle
r="5"
cy="73.337151"
cx="9.9078016"
id="path4627-90-7"
style="fill:#999999;stroke:none;stroke-width:1.99999988;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1" />
<text
id="text94-3-3"
y="76.117149"
x="9.962677"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="76.117149"
x="9.962677"
id="tspan92-3-2"
sodipodi:role="line">$</tspan></text>
</g>
<g
transform="translate(64.573611,-64.573953)"
id="g3740-87-6">
<circle
r="5"
cy="73.337151"
cx="9.9078016"
id="path4627-90-5"
style="fill:#999999;stroke:none;stroke-width:1.99999988;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1" />
<text
id="text94-3-2"
y="76.117149"
x="9.962677"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="76.117149"
x="9.962677"
id="tspan92-3-6"
sodipodi:role="line">$</tspan></text>
</g>
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:square"
id="line36-5"
y2="66"
x2="18"
y1="50"
x1="18" />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="272.58463"
height="18.028484"
version="1.1"
id="svg42"
sodipodi:docname="blocks.svg"
inkscape:version="0.92.4 (f8dce91, 2019-08-02)">
<metadata
id="metadata48">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>5 by 5 orthogonal maze</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs46" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1850"
inkscape:window-height="911"
id="namedview44"
showgrid="false"
inkscape:zoom="3.573689"
inkscape:cx="142.51535"
inkscape:cy="-34.245029"
inkscape:window-x="70"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg42" />
<title
id="title2">5 by 5 orthogonal maze</title>
<desc
id="desc4">5 by 5 orthogonal maze generated by The Maze Generator Website (http://www.mazegenerator.net/).</desc>
<g
id="g4698"
transform="translate(-29.438004,-48.985758)">
<text
id="text94-0"
y="60.944"
x="49.427567"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="60.944"
x="49.427567"
id="tspan92-6"
sodipodi:role="line">Andrew</tspan></text>
<g
transform="translate(-3.5477543)"
id="g4689">
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line34"
y2="66"
x2="71.968018"
y1="50"
x1="71.968018" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4"
y2="50"
x2="71.968018"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line36-5"
y2="66"
x2="34"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-3"
y2="66"
x2="71.968018"
y1="66"
x1="34" />
</g>
</g>
<g
id="g4698-6"
transform="translate(17.079621,-48.985758)">
<text
id="text94-0-7"
y="60.944"
x="49.427567"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="60.944"
x="49.427567"
id="tspan92-6-5"
sodipodi:role="line">Yvonne</tspan></text>
<g
transform="translate(-3.5477543)"
id="g4689-3">
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line34-5"
y2="66"
x2="71.968018"
y1="50"
x1="71.968018" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-6"
y2="50"
x2="71.968018"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line36-5-2"
y2="66"
x2="34"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-3-9"
y2="66"
x2="71.968018"
y1="66"
x1="34" />
</g>
</g>
<g
id="g4698-1"
transform="translate(63.597243,-48.985758)">
<text
id="text94-0-2"
y="60.944"
x="49.427567"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="60.944"
x="49.427567"
id="tspan92-6-7"
sodipodi:role="line">Declan</tspan></text>
<g
transform="translate(-3.5477543)"
id="g4689-0">
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line34-9"
y2="66"
x2="71.968018"
y1="50"
x1="71.968018" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-36"
y2="50"
x2="71.968018"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line36-5-0"
y2="66"
x2="34"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-3-6"
y2="66"
x2="71.968018"
y1="66"
x1="34" />
</g>
</g>
<g
id="g4698-6-2"
transform="translate(110.11487,-48.985758)">
<text
id="text94-0-7-6"
y="60.944"
x="49.427567"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="60.944"
x="49.427567"
id="tspan92-6-5-1"
sodipodi:role="line">Trevor</tspan></text>
<g
transform="translate(-3.5477543)"
id="g4689-3-8">
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line34-5-7"
y2="66"
x2="71.968018"
y1="50"
x1="71.968018" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-6-9"
y2="50"
x2="71.968018"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line36-5-2-2"
y2="66"
x2="34"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-3-9-0"
y2="66"
x2="71.968018"
y1="66"
x1="34" />
</g>
</g>
<g
id="g4698-1-2"
transform="translate(156.63249,-48.985758)">
<text
id="text94-0-2-3"
y="60.944"
x="49.427567"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="60.944"
x="49.427567"
id="tspan92-6-7-7"
sodipodi:role="line">Alice</tspan></text>
<g
transform="translate(-3.5477543)"
id="g4689-0-5">
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line34-9-9"
y2="66"
x2="71.968018"
y1="50"
x1="71.968018" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-36-2"
y2="50"
x2="71.968018"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line36-5-0-2"
y2="66"
x2="34"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-3-6-8"
y2="66"
x2="71.968018"
y1="66"
x1="34" />
</g>
</g>
<g
id="g4698-6-2-9"
transform="translate(203.15012,-48.985758)">
<text
id="text94-0-7-6-7"
y="60.944"
x="49.427567"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.33333302px;line-height:1.25;font-family:'M+ 1m';-inkscape-font-specification:'M+ 1m';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:600;font-stretch:normal;font-size:8px;font-family:Montserrat;-inkscape-font-specification:'Montserrat Semi-Bold';text-align:center;text-anchor:middle"
y="60.944"
x="49.427567"
id="tspan92-6-5-1-3"
sodipodi:role="line">Kevin</tspan></text>
<g
transform="translate(-3.5477543)"
id="g4689-3-8-6">
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line34-5-7-1"
y2="66"
x2="71.968018"
y1="50"
x1="71.968018" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-6-9-2"
y2="50"
x2="71.968018"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round"
id="line36-5-2-2-9"
y2="66"
x2="34"
y1="50"
x1="34" />
<line
style="fill:none;stroke:#000000;stroke-width:1.99999905;stroke-linecap:round;stroke-linejoin:round"
id="line18-4-3-9-0-3"
y2="66"
x2="71.968018"
y1="66"
x1="34" />
</g>
</g>
</svg>
# Objectives
* Gain a better understanding of previously covered concepts of the Python programming language
through the completion of practical exercises.
# Exercises
## Exercise 1
```python
"""
With the maze below, write directions to move through the maze,
picking up each coin as you go,
using only the instructions: forward, left, and right.
Write one instruction per line on your paper.
Start at the entry to the maze and move until each coin is
picked up before returning the the entry point.
Moving into a square that has a coin will collect that coin.
Each coin can be collected only once, though its path can be
crossed multiple times.
Directions are from the point of view as if a person were
standing in the maze.
forward - moves one square
left - turns 90 degrees to the left, but does not move a square
right - turns 90 degrees to the right, but does not move a square
"""
```
<figure markdown>
![Coin Maze](.img/coin_maze.svg){ width="400" }
<figcaption>Coin Maze</figcaption>
</figure>
## Exercise 2
```python
"""
With the name tags shown below, write directions to move each
of the name tags so that they are in alphabetical order.
Use only the directions left and right.
Write one instruction per line on your paper.
Each instruction should include the name tag and the direction,
such as: Andrew right
Each instruction will only move the given name tag one
location to the left or right.
Example:
Trevor left # moves Trevor between Yvonne and Declan.
"""
```
<figure markdown>
![Name Tags](.img/nametags.svg){ width="550" }
<figcaption>Name Tags</figcaption>
</figure>
## Exercise 3
```python
"""
Use the interactive `help()` function to find additional
information on 4 topics from the list of available `topics`.
Some recommended topics include `str`, `int`, `float`, `bool`,
`print`, and `input`.
"""
```
## Exercise 4
```python
"""
Use the interactive Python shell(REPL) to assign a literal string
for a first name in one variable and another literal string
for the last name.
Print the information in the two variables as a full name.
"""
```
## Exercise 5
```python
"""
Place the code used in the previous two exercises into a
python file, with a name of your choosing.
The file name should be indicative as to what the program does.
Run the program from the command line.
"""
```
## Exercise 6
```python
"""
Edit the file created in the previous exercise such that the last name is printed before the first name, separated by a comma.
Rather than save over the original file, Save this version of the file under a new name and execute (run) it.
"""
```
## Exercise 7
```python
"""
A person receives a dime, 2 nickels, 2 quarters, and 4 pennies
in change from a purchase.
Write a program to calculate how much money was received in
change.
"""
```
## Exercise 8
```python
"""
A video streaming service is being offered for $15 a month
with a 10% discount for buying a years worth in advance.
Write a program that answers the following questions:
What is the yearly price for someone paying per month and
the discounted yearly rate?
How much is saved in a year by purchasing the yearly
membership over the monthly membership?
"""
```
## Exercise 9
```python
"""
What is the difference in height (in inches) of one person
who stands 7'2" and another that stands 5'8"?
"""
```
## Exercise 10
```python
"""
Create four literal strings, with each one holding the Unicode
characters for the 13 playing cards in a suit: Ace, Two, ...
Queen, King.
Print the four strings to output a deck of cards.
"""
```
## Exercise 11
```python
"""
Print out the number 129 in binary, octal, and hexadecimal.
Then define variables to hold the number 129 supplied as a
binary literal, octal literal, and a hexadecimal literal value.
"""
```
## Exercise 12
```python
"""
Given the following statement: `letter = "A"`.
Use the `ord()` and `chr()` functions to print out the
letter `B`.
"""
```
## Exercise 13
```python
"""
Store the literal string of _Hello_ in as many ways as you
can think of.
Each representation should be stored in its own variable.
"""
```
## Exercise 14
```python
# Determine how many different string objects are stored in the
# variables below.
farewell_a = "Goodbye"
farewell_b = "Goodbye"
farewell_c = 'Goodbye'
farewell_d = "Good" + "bye"
farewell_e = "good" + 'bye'
farewell_f = "goodbye"
farewell_g = 'adios,' + 'dag,' + 'さようなら,' + \
'Auf Wiedersehen,' + 'later'
farewell_h = str(farewell_g)
```
## Exercise 15
```python
"""
Print the numbers 1 through 10, inclusive, as comma separated
values all on the same line.
"""
```
## Exercise 16
```python
"""
Using a single `print` statement:
Print the numbers 1 through 10, inclusive, with each number
on its own line in the output.
"""
```
## Exercise 17
```python
"""
Write an application that prompts the user to enter a name
three times and stores each name in its own variable.
After collecting the names, print all of the names on a
single line.
"""
```
## Exercise 18
```python
"""
Rewrite the previous application so that it also prints, on a
separate line, the total number of characters in all of the
names supplied.
"""
```
## Exercise 19
```python
"""
Rewrite the previous application once again so that the output:
Prints each name and the number of characters in the name.
The name should be first and the length second.
The name and length should be right justified with a minimum
width of 15.
"""
```
## Exercise 20
```python
"""
A student wishes to be able to determine their grade average
after taking 5 tests.
Write an application that allows the user to input all 5 test
scores and print out the average.
"""
```
\ No newline at end of file
# Objectives
* Gain a better understanding of previously covered concepts of the Python programming language
through the completion of practical exercises.
# Exercises
## Exercise 1
```python
"""
With the maze below, write directions to move through the maze,
picking up each coin as you go,
using only the instructions: forward, left, and right.
Write one instruction per line on your paper.
Start at the entry to the maze and move until each coin is
picked up before returning the the entry point.
Moving into a square that has a coin will collect that coin.
Each coin can be collected only once, though its path can be
crossed multiple times.
Directions are from the point of view as if a person were
standing in the maze.
forward - moves one square
left - turns 90 degrees to the left, but does not move a square
right - turns 90 degrees to the right, but does not move a square
"""
```
<figure markdown>
![Coin Maze](.img/coin_maze.svg){ width="400" }
<figcaption>Coin Maze</figcaption>
</figure>
## Exercise 2
```python
"""
With the name tags shown below, write directions to move each
of the name tags so that they are in alphabetical order.
Use only the directions left and right.
Write one instruction per line on your paper.
Each instruction should include the name tag and the direction,
such as: Andrew right
Each instruction will only move the given name tag one
location to the left or right.
Example:
Trevor left # moves Trevor between Yvonne and Declan.
"""
```
<figure markdown>
![Name Tags](.img/nametags.svg){ width="550" }
<figcaption>Name Tags</figcaption>
</figure>
## Exercise 3
```python
"""
Use the interactive `help()` function to find additional
information on 4 topics from the list of available `topics`.
Some recommended topics include `str`, `int`, `float`, `bool`,
`print`, and `input`.
"""
```
## Exercise 4
```python
"""
Use the interactive Python shell(REPL) to assign a literal string
for a first name in one variable and another literal string
for the last name.
Print the information in the two variables as a full name.
"""
```
## Exercise 5
```python
"""
Place the code used in the previous two exercises into a
python file, with a name of your choosing.
The file name should be indicative as to what the program does.
Run the program from the command line.
"""
```
## Exercise 6
```python
"""
Edit the file created in the previous exercise such that the last name is printed before the first name, separated by a comma.
Rather than save over the original file, Save this version of the file under a new name and execute (run) it.
"""
```
## Exercise 7
```python
"""
A person receives a dime, 2 nickels, 2 quarters, and 4 pennies
in change from a purchase.
Write a program to calculate how much money was received in
change.
"""
```
## Exercise 8
```python
"""
A video streaming service is being offered for $15 a month
with a 10% discount for buying a years worth in advance.
Write a program that answers the following questions:
What is the yearly price for someone paying per month and
the discounted yearly rate?
How much is saved in a year by purchasing the yearly
membership over the monthly membership?
"""
```
## Exercise 9
```python
"""
What is the difference in height (in inches) of one person
who stands 7'2" and another that stands 5'8"?
"""
```
## Exercise 10
```python
"""
Create four literal strings, with each one holding the Unicode
characters for the 13 playing cards in a suit: Ace, Two, ...
Queen, King.
Print the four strings to output a deck of cards.
"""
```
## Exercise 11
```python
"""
Print out the number 129 in binary, octal, and hexadecimal.
Then define variables to hold the number 129 supplied as a
binary literal, octal literal, and a hexadecimal literal value.
"""
```
## Exercise 12
```python
"""
Given the following statement: `letter = "A"`.
Use the `ord()` and `chr()` functions to print out the
letter `B`.
"""
```
## Exercise 13
```python
"""
Store the literal string of _Hello_ in as many ways as you
can think of.
Each representation should be stored in its own variable.
"""
```
## Exercise 14
```python
# Determine how many different string objects are stored in the
# variables below.
farewell_a = "Goodbye"
farewell_b = "Goodbye"
farewell_c = 'Goodbye'
farewell_d = "Good" + "bye"
farewell_e = "good" + 'bye'
farewell_f = "goodbye"
farewell_g = 'adios,' + 'dag,' + 'さようなら,' + \
'Auf Wiedersehen,' + 'later'
farewell_h = str(farewell_g)
```
## Exercise 15
```python
"""
Print the numbers 1 through 10, inclusive, as comma separated
values all on the same line.
"""
```
## Exercise 16
```python
"""
Using a single `print` statement:
Print the numbers 1 through 10, inclusive, with each number
on its own line in the output.
"""
```
## Exercise 17
```python
"""
Write an application that prompts the user to enter a name
three times and stores each name in its own variable.
After collecting the names, print all of the names on a
single line.
"""
```
## Exercise 18
```python
"""
Rewrite the previous application so that it also prints, on a
separate line, the total number of characters in all of the
names supplied.
"""
```
## Exercise 19
```python
"""
Rewrite the previous application once again so that the output:
Prints each name and the number of characters in the name.
The name should be first and the length second.
The name and length should be right justified with a minimum
width of 15.
"""
```
## Exercise 20
```python
"""
A student wishes to be able to determine their grade average
after taking 5 tests.
Write an application that allows the user to input all 5 test
scores and print out the average.
"""
```
\ No newline at end of file
......@@ -48,7 +48,10 @@
- Input/Output
- print()
- input()
- Working with Text Files (Basic)
- Working with Text Files
- Basic Reading/Writing
- with statement introduction
- Common file operations
### Day 4
......@@ -208,8 +211,8 @@
- Advanced Python Concepts
- Iterators and Iterables
- Generators
- Decorators Deep Dive
- Context Managers
- Decorators (Comprehensive Coverage)
- Context Managers (Comprehensive Coverage)
- Advanced Comprehensions
### Day 2
......@@ -245,15 +248,6 @@
### Day 4
- Development Tools
- Debugging Tools
- Profiling
- Documentation Tools
- Static Analysis
- Code Quality Tools
### Day 5
- Introduction to Classes
- Classes and Objects Basics
- Class Attributes vs Instance Attributes
......@@ -262,6 +256,20 @@
- Abstraction
- Polymorphism
### Day 5
- Logging API
- Logging Levels
- Logging Formats
- Logging to different outputs
- Development Tools
- Debugging Tools
- Profiling
- Documentation Tools
- Static Analysis
- Code Quality Tools
### Day 6
- Lab / Review Day
......@@ -312,6 +320,15 @@
- Object Lifecycle (`__del__`)
### Day 5
- Testing Object-Oriented Code
- Unit Testing Classes
- Test Doubles (Mocks, Stubs)
- Testing Inheritance
- Testing Protocols
- Integration Testing
- Test-Driven Development
### Day 6
- SOLID Design Principles
- Single Responsibility Principle
- Open/Closed Principle
......@@ -320,7 +337,7 @@
- Dependency Inversion Principle
- Practical Applications
### Day 6
### Day 7
- Design Patterns
- Creational Patterns
......@@ -336,7 +353,7 @@
- Strategy
- Command
### Day 7
### Day 8
- Advanced Class Features
- Metaclasses Introduction
......@@ -346,7 +363,7 @@
- Advanced Property Patterns
- Operator Overloading
### Day 8
### Day 9
- Object Protocols and Duck Typing
- Sequence Protocol
......@@ -356,16 +373,6 @@
- Callable Protocol
- Protocol Design Patterns
### Day 9
- Testing Object-Oriented Code
- Unit Testing Classes
- Test Doubles (Mocks, Stubs)
- Testing Inheritance
- Testing Protocols
- Integration Testing
- Test-Driven Development
### Day 10
- Advanced OOP Patterns
......
......@@ -18,6 +18,8 @@ nav:
- Day 5:
- Conditionals: py_1_1/07_conditionals.md
- Loops: py_1_1/08_loops.md
- Day 6:
- Lab: py_1_1/lab_1.md
# - Day 6:
# - Review Day: py_1_1/block_1_review_day.md
# - Python 1 Block 2:
......
for i in range(-10, 10):
print(i, hash(i))
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment