Skip to content

Commit f6bfb8c

Browse files
created
work from fall 2021, intro to programming course in python
1 parent 2f948ec commit f6bfb8c

File tree

193 files changed

+8921
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+8921
-0
lines changed

final_exam_practice/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>final_exam_practice</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
16+
</natures>
17+
</projectDescription>

final_exam_practice/.pydevproject

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?><pydev_project>
3+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
4+
<path>/${PROJECT_DIR_NAME}/src</path>
5+
</pydev_pathproperty>
6+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
7+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
8+
</pydev_project>

final_exam_practice/sales.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
100
2+
90
3+
95
4+
120
5+
159
6+
600

final_exam_practice/src/sales.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
James 1
2+
Matt 2
3+
Calvin 4
4+
Vincent 4

final_exam_practice/src/t01.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""
2+
-------------------------------------------------------
3+
[program description]
4+
-------------------------------------------------------
5+
Author: Aleksander Sienkiewicz
6+
ID: 210222490
7+
8+
__updated__ = "2021-12-15"
9+
-------------------------------------------------------
10+
"""
11+
# Imports
12+
13+
# Constants
14+
15+
def func():
16+
"""
17+
-------------------------------------------------------
18+
description
19+
Use:
20+
-------------------------------------------------------
21+
Parameters:
22+
name - description (type)
23+
Returns:
24+
name - description (type)
25+
------------------------------------------------------
26+
"""
27+
def string_splosion(my_str):
28+
out_str=''
29+
for i in range(1,len(my_str)+1):
30+
out_str+=my_str[0:i]
31+
return out_str
32+
print(string_splosion("Code"))
33+
34+
35+
36+

l10/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>l10</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
16+
</natures>
17+
</projectDescription>

l10/.pydevproject

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?><pydev_project>
3+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
4+
<path>/${PROJECT_DIR_NAME}/src</path>
5+
</pydev_pathproperty>
6+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
7+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
8+
</pydev_project>

lab_1_test/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>lab_1_test</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
16+
</natures>
17+
</projectDescription>

lab_1_test/.pydevproject

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?><pydev_project>
3+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
4+
<path>/${PROJECT_DIR_NAME}</path>
5+
</pydev_pathproperty>
6+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
7+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
8+
</pydev_project>

sien2490_a01/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>sien2490_a01</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.python.pydev.PyDevBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.python.pydev.pythonNature</nature>
16+
</natures>
17+
</projectDescription>

sien2490_a01/.pydevproject

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<?eclipse-pydev version="1.0"?><pydev_project>
3+
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
4+
<path>/${PROJECT_DIR_NAME}/src</path>
5+
</pydev_pathproperty>
6+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
7+
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
8+
</pydev_project>

sien2490_a01/src/t01.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
-------------------------------------------------------
3+
print 4 statements using different types of quotations
4+
-------------------------------------------------------
5+
Author: Aleksander Sienkiewicz
6+
ID: 210222490
7+
8+
__updated__ = "2021-09-20"
9+
-------------------------------------------------------
10+
"""
11+
# Imports
12+
13+
# Constants
14+
15+
def func():
16+
"""
17+
-------------------------------------------------------
18+
description
19+
Use:
20+
-------------------------------------------------------
21+
Parameters:
22+
name - description (type)
23+
Returns:
24+
name - description (type)
25+
------------------------------------------------------
26+
"""
27+
#use of single quotation so i can use double within them
28+
print('The book title is, "The Fifth Season".')
29+
#use of double so i can use apostrophes within them
30+
print("What's mine is mine, and what's yours is mine.")
31+
#use of triple single
32+
print('''"Experience is one thing you can't get for nothing." Oscar Wilde''')
33+
#used tripple double quotation to have multiple lines within
34+
print("""Three things cannot be long hidden:
35+
the sun,
36+
the moon,
37+
and the truth.""")

sien2490_a01/src/t02.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
-------------------------------------------------------
3+
This program asks the user for their age and their favourite band, in that order, and then prints their answers:
4+
-------------------------------------------------------
5+
Author: Aleksander Sienkiewicz
6+
ID: 210222490
7+
8+
__updated__ = "2021-09-20"
9+
-------------------------------------------------------
10+
"""
11+
# Imports
12+
13+
# Constants
14+
15+
def func():
16+
"""
17+
-------------------------------------------------------
18+
description
19+
Use:
20+
-------------------------------------------------------
21+
Parameters:
22+
name - description (type)
23+
Returns:
24+
name - description (type)
25+
------------------------------------------------------
26+
"""
27+
#inputs from user
28+
age= input('Enter your age: ')
29+
favouriteBand = input('Enter your favourite band: ')
30+
#print statement to return information to user
31+
print(f'I am {age} years old and my favourite band is {favouriteBand}')
32+

sien2490_a01/src/t03.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
-------------------------------------------------------
3+
convert from miles to km and display output to user
4+
-------------------------------------------------------
5+
Author: Aleksander Sienkiewicz
6+
ID: 210222490
7+
8+
__updated__ = "2021-09-21"
9+
-------------------------------------------------------
10+
"""
11+
# Imports
12+
13+
# Constants
14+
15+
def func():
16+
"""
17+
-------------------------------------------------------
18+
description
19+
Use:
20+
-------------------------------------------------------
21+
Parameters:
22+
name - description (type)
23+
Returns:
24+
name - description (type)
25+
------------------------------------------------------
26+
"""
27+
#input from user
28+
miles = float(input('Enter length in miles: '))
29+
#calculation to convert fro miiles to km
30+
kmlength = float(miles*1.60934)
31+
#print statement to display length in km to suer
32+
print(f'{miles} miles is equal to {kmlength} kilometres' )

sien2490_a01/src/t04.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""
2+
-------------------------------------------------------
3+
Caculate total cost for a customer given the cost of burriots and number of burritos purchased
4+
-------------------------------------------------------
5+
Author: Aleksander Sienkiewicz
6+
ID: 210222490
7+
8+
__updated__ = "2021-09-21"
9+
-------------------------------------------------------
10+
"""
11+
# Imports
12+
13+
# Constants
14+
15+
def func():
16+
"""
17+
-------------------------------------------------------
18+
description
19+
Use:
20+
-------------------------------------------------------
21+
Parameters:
22+
name - description (type)
23+
Returns:
24+
name - description (type)
25+
------------------------------------------------------
26+
"""
27+
#inputs from user
28+
cost= float(input('Cost of 1 burrito: $'))
29+
numBurritos= int(input('Number of burritos: '))
30+
#calculation for total cost of burritos
31+
totalCost = cost*numBurritos
32+
#print statement for total cost
33+
print(f'Total cost of {numBurritos} burritos: $ {totalCost}')

sien2490_a01/src/t05.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""
2+
-------------------------------------------------------
3+
Calculate balance that customer has to pay given principal, interest rate,
4+
number of years, and number of times interest is compounded
5+
6+
-------------------------------------------------------
7+
Author: Aleksander Sienkiewicz
8+
ID: 210222490
9+
10+
__updated__ = "2021-09-21"
11+
-------------------------------------------------------
12+
"""
13+
# Imports
14+
15+
# Constants
16+
17+
def func():
18+
"""
19+
-------------------------------------------------------
20+
description
21+
Use:
22+
-------------------------------------------------------
23+
Parameters:
24+
name - description (type)
25+
Returns:
26+
name - description (type)
27+
------------------------------------------------------
28+
"""
29+
#inputs from user
30+
principal= float(input('Principal: $ '))
31+
interest= float(input('Interest (decimal) : '))
32+
numYears= int(input('Number of years: '))
33+
compoundedCount= int(input('Number of times interest compounded per year: '))
34+
#calculation for balance
35+
balance= principal* (1+ interest/compoundedCount)**(compoundedCount*numYears)
36+
#use round function to round to 2 decimal places, user does not want an answer with 5 decimal places
37+
roundedBalance = round(balance,2)
38+
#print statement
39+
print(f'Balance: ${roundedBalance}')

0 commit comments

Comments
 (0)