Skip to content

Commit 71b3aa3

Browse files
Add files via upload
1 parent 0785506 commit 71b3aa3

12 files changed

+101
-0
lines changed

Diff for: CityProfits.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Atlanta
2+
15943.49
3+
47136.38
4+
48139.29
5+
New York
6+
39473.24
7+
48134.20
8+
53942.87

Diff for: CityProfits2.txt

Whitespace-only changes.

Diff for: CityProfitsWithMetaData.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Atlanta
2+
3
3+
15943.49
4+
47136.38
5+
48139.29
6+
New York
7+
5
8+
39473.24
9+
48134.20
10+
53942.87
11+
34123.12
12+
54123.11

Diff for: City_Profits.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
city_data = open('CityProfits.txt', 'r')
2+
city_name = city_data.readline().rstrip('\n')
3+
while city_name != '':
4+
q1_profit = float(city_data.readline())
5+
q2_profit = float(city_data.readline())
6+
q3_profit = float(city_data.readline())
7+
tot_profit = q1_profit + q2_profit + q3_profit
8+
print(city_name, "profit is $", tot_profit)
9+
city_name = city_data.readline().rstrip('\n')
10+
city_data.close()

Diff for: City_Profits_MetaData.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
city_data = open('CityProfitsWithMetaData.txt', 'r')
2+
city_name = city_data.readline().rstrip('\n')
3+
while city_name != '':
4+
num_counties = int(city_data.readline())
5+
total = 0
6+
for i in range(num_counties):
7+
total += float(city_data.readline())
8+
9+
print(city_name, "Total for State is $", total)
10+
city_name = city_data.readline().rstrip('\n')
11+
city_data.close()

Diff for: ClassList.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MIS304
2+
MIS385
3+
EE461L

Diff for: Exceptions.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
try:
2+
city_data = open('CityProfits2.txt', 'r')
3+
q1_profit = float(city_data.readline())
4+
city_data.close()
5+
except FileNotFoundError:
6+
print("Could not find CityProfit2.txt in current directory")
7+
except ValueError:
8+
print("No data found in teh file")

Diff for: File_Append.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#learn about append
2+
import datetime
3+
4+
currentDT = datetime.datetime.now()
5+
print (str(currentDT))
6+
7+
file=open("TryAppend.txt", 'a')
8+
file.write((str(currentDT)+'\n'))
9+
file.close()

Diff for: StudentNames.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Buzz Lightyear
2+
Abominable Snowman
3+
Doc Hudson
4+
Mickey Mouse
5+
Sleeping Beauty
6+
Donald Duck
7+
Spider Man
8+
Deadpool
9+
Thor
10+
Iron Man
11+
Captain America
12+
Black Panther
13+
Silver Surfer
14+
Ghost Rider
15+
Professor X
16+
Ghost Rider
17+
Human Torch
18+
Moon Knight
19+
Sam Wilson
20+
Sid Phillips
21+

Diff for: Student_Names.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
s = open('studentnames.txt', 'r')
2+
print(s.readline().rstrip('\n'))
3+
print(s.readline().rstrip('\n'))
4+
print(s.readline().rstrip('\n'))
5+
print(s.readline().rstrip('\n'))
6+
print(s.readline().rstrip('\n'))
7+
print(s.readline().rstrip('\n'))
8+
s.close()

Diff for: TryAppend.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2022-09-07 16:10:56.134418
2+
2022-09-07 16:11:09.535780
3+
2022-09-07 17:11:12.508324
4+
2022-09-07 18:38:19.467371

Diff for: write_data.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
class_data = open('ClassList.txt', 'w')
3+
for classes in range(3):
4+
class_name = input("Please enter a class (e.g. MIS 304): ")
5+
class_data.write(class_name + "\n")
6+
class_data.close()
7+

0 commit comments

Comments
 (0)