Skip to content

Commit 5d7a206

Browse files
committed
Add code examples and updated gitignore
1 parent 5aadded commit 5d7a206

40 files changed

+1385
-4
lines changed

.gitignore

+310-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,310 @@
1-
.DS_Store
2-
node_modules
3-
.tmp
4-
npm-debug.log
1+
# Apple
2+
*.DS_Store
3+
4+
# Built application files
5+
*.apk
6+
*.ap_
7+
8+
# Files for the Dalvik VM
9+
*.dex
10+
11+
# Java class files
12+
*.class
13+
14+
# Generated files
15+
bin/
16+
gen/
17+
18+
# Gradle files
19+
.gradle/
20+
build/
21+
22+
# Local configuration file (sdk path, etc)
23+
local.properties
24+
25+
# Proguard folder generated by Eclipse
26+
proguard/
27+
28+
# Log Files
29+
*.log
30+
31+
# Android Studio Navigation editor temp files
32+
.navigation/
33+
34+
# Android Studio captures folder
35+
captures/
36+
37+
# Google Doc files
38+
*.gsheet
39+
*.gslides
40+
*.gdoc
41+
42+
# MS Office files
43+
*.xls_
44+
*.doc_
45+
*.ppt_
46+
47+
# PDF files
48+
*.pdf
49+
50+
# ZIP files
51+
*.zip
52+
53+
# VISUAL STUDIO FILES
54+
55+
# User-specific files
56+
*.suo
57+
*.user
58+
*.userosscache
59+
*.sln.docstates
60+
61+
# User-specific files (MonoDevelop/Xamarin Studio)
62+
*.userprefs
63+
64+
# Build results
65+
[Dd]ebug/
66+
[Dd]ebugPublic/
67+
[Rr]elease/
68+
[Rr]eleases/
69+
x64/
70+
x86/
71+
bld/
72+
[Bb]in/
73+
[Oo]bj/
74+
[Ll]og/
75+
__pycache__/
76+
77+
# Visual Studio 2015 cache/options directory
78+
.vs/
79+
# Uncomment if you have tasks that create the project's static files in wwwroot
80+
#wwwroot/
81+
82+
# MSTest test Results
83+
[Tt]est[Rr]esult*/
84+
[Bb]uild[Ll]og.*
85+
86+
# NUNIT
87+
*.VisualState.xml
88+
TestResult.xml
89+
90+
# Build Results of an ATL Project
91+
[Dd]ebugPS/
92+
[Rr]eleasePS/
93+
dlldata.c
94+
95+
# DNX
96+
project.lock.json
97+
artifacts/
98+
99+
*_i.c
100+
*_p.c
101+
*_i.h
102+
*.ilk
103+
*.meta
104+
*.obj
105+
*.pch
106+
*.pdb
107+
*.pgc
108+
*.pgd
109+
*.rsp
110+
*.sbr
111+
*.tlb
112+
*.tli
113+
*.tlh
114+
*.tmp
115+
*.tmp_proj
116+
*.log
117+
*.vspscc
118+
*.vssscc
119+
.builds
120+
*.pidb
121+
*.svclog
122+
*.scc
123+
124+
# Chutzpah Test files
125+
_Chutzpah*
126+
127+
# Visual C++ cache files
128+
ipch/
129+
*.aps
130+
*.ncb
131+
*.opendb
132+
*.opensdf
133+
*.sdf
134+
*.cachefile
135+
*.VC.db
136+
*.VC.VC.opendb
137+
138+
# Visual Studio profiler
139+
*.psess
140+
*.vsp
141+
*.vspx
142+
*.sap
143+
144+
# TFS 2012 Local Workspace
145+
$tf/
146+
147+
# Guidance Automation Toolkit
148+
*.gpState
149+
150+
# ReSharper is a .NET coding add-in
151+
_ReSharper*/
152+
*.[Rr]e[Ss]harper
153+
*.DotSettings.user
154+
155+
# JustCode is a .NET coding add-in
156+
.JustCode
157+
158+
# TeamCity is a build add-in
159+
_TeamCity*
160+
161+
# DotCover is a Code Coverage Tool
162+
*.dotCover
163+
164+
# NCrunch
165+
_NCrunch_*
166+
.*crunch*.local.xml
167+
nCrunchTemp_*
168+
169+
# MightyMoose
170+
*.mm.*
171+
AutoTest.Net/
172+
173+
# Web workbench (sass)
174+
.sass-cache/
175+
176+
# Installshield output folder
177+
[Ee]xpress/
178+
179+
# DocProject is a documentation generator add-in
180+
DocProject/buildhelp/
181+
DocProject/Help/*.HxT
182+
DocProject/Help/*.HxC
183+
DocProject/Help/*.hhc
184+
DocProject/Help/*.hhk
185+
DocProject/Help/*.hhp
186+
DocProject/Help/Html2
187+
DocProject/Help/html
188+
189+
# Click-Once directory
190+
publish/
191+
192+
# Publish Web Output
193+
*.[Pp]ublish.xml
194+
*.azurePubxml
195+
# TODO: Comment the next line if you want to checkin your web deploy settings
196+
# but database connection strings (with potential passwords) will be unencrypted
197+
*.pubxml
198+
*.publishproj
199+
200+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
201+
# checkin your Azure Web App publish settings, but sensitive information contained
202+
# in these scripts will be unencrypted
203+
PublishScripts/
204+
205+
# NuGet Packages
206+
*.nupkg
207+
# The packages folder can be ignored because of Package Restore
208+
**/packages/*
209+
# except build/, which is used as an MSBuild target.
210+
!**/packages/build/
211+
# Uncomment if necessary however generally it will be regenerated when needed
212+
#!**/packages/repositories.config
213+
# NuGet v3's project.json files produces more ignoreable files
214+
*.nuget.props
215+
*.nuget.targets
216+
217+
# Microsoft Azure Build Output
218+
csx/
219+
*.build.csdef
220+
221+
# Microsoft Azure Emulator
222+
ecf/
223+
rcf/
224+
225+
# Windows Store app package directories and files
226+
AppPackages/
227+
BundleArtifacts/
228+
Package.StoreAssociation.xml
229+
_pkginfo.txt
230+
231+
# Visual Studio cache files
232+
# files ending in .cache can be ignored
233+
*.[Cc]ache
234+
# but keep track of directories ending in .cache
235+
!*.[Cc]ache/
236+
237+
# Others
238+
ClientBin/
239+
~$*
240+
*~
241+
*.dbmdl
242+
*.dbproj.schemaview
243+
*.pfx
244+
*.publishsettings
245+
node_modules/
246+
orleans.codegen.cs
247+
248+
# Since there are multiple workflows, uncomment next line to ignore bower_components
249+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
250+
#bower_components/
251+
252+
# RIA/Silverlight projects
253+
Generated_Code/
254+
255+
# Backup & report files from converting an old project file
256+
# to a newer Visual Studio version. Backup files are not needed,
257+
# because we have git ;-)
258+
_UpgradeReport_Files/
259+
Backup*/
260+
UpgradeLog*.XML
261+
UpgradeLog*.htm
262+
263+
# SQL Server files
264+
*.mdf
265+
*.ldf
266+
267+
# Business Intelligence projects
268+
*.rdl.data
269+
*.bim.layout
270+
*.bim_*.settings
271+
272+
# Microsoft Fakes
273+
FakesAssemblies/
274+
275+
# GhostDoc plugin setting file
276+
*.GhostDoc.xml
277+
278+
# Node.js Tools for Visual Studio
279+
.ntvs_analysis.dat
280+
281+
# Visual Studio 6 build log
282+
*.plg
283+
284+
# Visual Studio 6 workspace options file
285+
*.opt
286+
287+
# Visual Studio LightSwitch build output
288+
**/*.HTMLClient/GeneratedArtifacts
289+
**/*.DesktopClient/GeneratedArtifacts
290+
**/*.DesktopClient/ModelManifest.xml
291+
**/*.Server/GeneratedArtifacts
292+
**/*.Server/ModelManifest.xml
293+
_Pvt_Extensions
294+
295+
# Paket dependency manager
296+
.paket/paket.exe
297+
paket-files/
298+
299+
# FAKE - F# Make
300+
.fake/
301+
302+
# JetBrains Rider
303+
.idea/
304+
*.sln.iml
305+
306+
# VS Code folder
307+
.vscode/
308+
309+
# Databricks file
310+
*.pyi

Finished/Ch 1/challenge.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Python Object Oriented Programming by Joe Marini course example
2+
# Programming challenge: define a class to represent a stock symbol
3+
4+
5+
class StockSymbol:
6+
def __init__(self, ticker, price, company) -> None:
7+
self.ticker = ticker
8+
self.price = price
9+
self.company = company
10+
11+
def get_description(self):
12+
pass
13+

Finished/Ch 1/class_finished.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Python Object Oriented Programming by Joe Marini course example
2+
# Using class-level and static methods
3+
4+
5+
class Book:
6+
# TODO: Properties defined at the class level are shared by all instances
7+
BOOK_TYPES = ("HARDCOVER", "PAPERBACK", "EBOOK")
8+
# TODO: double-underscore properties are hidden from other classes
9+
__booklist = None
10+
11+
# static methods do not receive class or instance arguments
12+
# and usually operate on data that is not instance-specific
13+
@staticmethod
14+
def get_booklist():
15+
if Book.__booklist == None:
16+
Book.__booklist = []
17+
return Book.__booklist
18+
19+
# class methods receive a class as their argument and can only
20+
# operate on class-level data
21+
@classmethod
22+
def get_book_types(cls):
23+
return cls.BOOK_TYPES
24+
25+
# instance methods receive a specific object instance as an argument
26+
# and operate on data specific to that object instance
27+
def set_title(self, newtitle):
28+
self.title = newtitle
29+
30+
def __init__(self, title, booktype):
31+
self.title = title
32+
if (not booktype in self.BOOK_TYPES):
33+
raise ValueError(f"{booktype} is not a valid book type")
34+
else:
35+
self.booktype = booktype
36+
37+
38+
# TODO: access the class attribute
39+
print("Book types: ", Book.get_book_types())
40+
41+
# TODO: Create some book instances
42+
b1 = Book("Title 1", "HARDCOVER")
43+
b2 = Book("Title 2", "PAPERBACK")
44+
45+
# TODO: Use the static method to access a singleton object
46+
thebooks = Book.get_booklist()
47+
thebooks.append(b1)
48+
thebooks.append(b2)
49+
print(thebooks)

Finished/Ch 1/definition_finished.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Python Object Oriented Programming by Joe Marini course example
2+
# Basic class definitions
3+
4+
5+
class Book:
6+
# the "init" function is called when the instance is
7+
# created and ready to be initialized
8+
def __init__(self, title):
9+
self.title = title
10+
11+
12+
# TODO: create instances of the class
13+
book1 = Book("Brave New World")
14+
book2 = Book("War and Peace")
15+
16+
# TODO: print the class and property
17+
print(book1)
18+
print(book1.title)

0 commit comments

Comments
 (0)