Skip to content

Commit 365887a

Browse files
authored
Add files via upload
1 parent a026ab7 commit 365887a

File tree

37 files changed

+451
-0
lines changed

37 files changed

+451
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Example, do not modify!
2+
print(5 / 8)
3+
print(7+10)
4+
# Put code below here

1_Python Basic_2_Any comments.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Just testing division
2+
print(5 / 8)
3+
4+
# Addition works too
5+
print(7 + 10)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Addition and subtraction
2+
print(5 + 5)
3+
print(5 - 5)
4+
5+
# Multiplication and division
6+
print(3 * 5)
7+
print(10 / 2)
8+
9+
# Exponentiation
10+
print(4 ** 2)
11+
12+
# Modulo
13+
print(18 % 7)
14+
15+
# How much is your $100 worth after 7 years?
16+
print(100*(1.1**7))
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Create a variable savings
2+
savings = 100
3+
4+
# Print out savings
5+
print(savings)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Create a variable savings
2+
savings = 100
3+
4+
# Create a variable factor
5+
factor=1.10
6+
7+
# Calculate result
8+
result=savings * factor ** 7
9+
10+
# Print out result
11+
print(result)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Create a variable desc
2+
desc="compound interest"
3+
4+
# Create a variable profitable
5+
profitable = True
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Several variables to experiment with
2+
savings = 100
3+
factor = 1.1
4+
desc = "compound interest"
5+
6+
# Assign product of factor and savings to year1
7+
year1=savings*factor
8+
9+
# Print the type of year1
10+
print(type(year1))
11+
12+
# Assign sum of desc and desc to doubledesc
13+
doubledesc=desc+desc
14+
15+
# Print out doubledesc
16+
print(doubledesc)

1_Python Basic_8_Type conversion.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Definition of savings and result
2+
savings = 100
3+
result = 100 * 1.10 ** 7
4+
5+
# Fix the printout
6+
print("I started with $" + str(savings) + " and now have $" + str(result) + ". Awesome!")
7+
8+
# Definition of pi_string
9+
pi_string = "3.1415926"
10+
11+
# Convert pi_string into float: pi_float
12+
pi_float=float(pi_string)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Create list areas
2+
areas = [11.25, 18.0, 20.0, 10.75, 9.50]
3+
4+
# Create areas_copy
5+
areas_copy = [11.25, 18.0, 20.0, 10.75, 9.50]
6+
7+
# Change areas_copy
8+
areas_copy[0] = 5.0
9+
10+
# Print areas
11+
print(areas)

2_Python List_1_Create a list.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# area variables (in square meters)
2+
hall = 11.25
3+
kit = 18.0
4+
liv = 20.0
5+
bed = 10.75
6+
bath = 9.50
7+
8+
# Create list areas
9+
areas=[11.25,18.0,20.0,10.75,9.50]
10+
11+
# Print areas
12+
print(areas)

0 commit comments

Comments
 (0)