Skip to content

Commit a0424b0

Browse files
authored
Update Chapter 3 - Functions and Packages .py
1 parent 0da1c61 commit a0424b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Intro to Python for Data Science/Chapter 3 - Functions and Packages .py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#------------------------------------------------------------------------------------------------------------#
12
# Familiar functions
23
# Create variables var1 and var2
34
var1 = [1, 2, 3, 4]
@@ -11,6 +12,7 @@
1112

1213
# Convert var2 to an integer: out2
1314
out2 = int(var2)
15+
#------------------------------------------------------------------------------------------------------------#
1416

1517
# Multiple arguments
1618
# Create lists first and second
@@ -25,6 +27,7 @@
2527

2628
# Print out full_sorted
2729
print(full_sorted)
30+
#------------------------------------------------------------------------------------------------------------#
2831

2932
#String Methods
3033
# string to experiment with: room
@@ -39,6 +42,7 @@
3942

4043
# Print out the number of o's in room
4144
print(room.count("o"))
45+
#------------------------------------------------------------------------------------------------------------#
4246

4347
#List Methods
4448
# Create list areas
@@ -49,6 +53,7 @@
4953

5054
# Print out how often 14.5 appears in areas
5155
print(areas.count(14.5))
56+
#------------------------------------------------------------------------------------------------------------#
5257

5358
#List Methods (2)
5459
# Create list areas
@@ -57,6 +62,8 @@
5762
# Use append twice to add poolhouse and garage size
5863
areas.append(24.5)
5964
areas.append(15.45)
65+
#------------------------------------------------------------------------------------------------------------#
66+
#------------------------------------------------------------------------------------------------------------#
6067

6168
# Print out areas
6269
print(areas)
@@ -66,6 +73,7 @@
6673

6774
# Print out areas
6875
print(areas)
76+
#------------------------------------------------------------------------------------------------------------#
6977

7078
#Import package
7179
# Definition of radius
@@ -79,10 +87,12 @@
7987

8088
# Calculate A
8189
A = math.pi * r ** 2
90+
#------------------------------------------------------------------------------------------------------------#
8291

8392
# Build printout
8493
print("Circumference: " + str(C))
8594
print("Area: " + str(A))
95+
#------------------------------------------------------------------------------------------------------------#
8696

8797
#Selective import
8898
# Definition of radius
@@ -97,4 +107,5 @@
97107
# Print out dist
98108
print(dist)
99109

110+
#------------------------------------------------------------------------------------------------------------#
100111

0 commit comments

Comments
 (0)