Skip to content

Commit 5c1319d

Browse files
authored
Add files via upload
1 parent 4659ffd commit 5c1319d

File tree

11 files changed

+3258
-0
lines changed

11 files changed

+3258
-0
lines changed

day-25/Squirrel Color Count.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
,Fur Color,Amount
2+
0,grey,2473
3+
1,red,392
4+
2,black,103

day-25/Squirrel_Census.csv

Lines changed: 3024 additions & 0 deletions
Large diffs are not rendered by default.

day-25/main.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# # with open ("weather_data.csv") as file:
2+
# # data = file.readlines()
3+
# # print(data)
4+
5+
# # import csv
6+
7+
# # with open ("weather_data.csv") as data_file:
8+
# # data = csv.reader(data_file)
9+
# # tempreature = []
10+
# # for row in data:
11+
# # if row[1] != 'temp':
12+
# # tempreature.append(int(row[1]))
13+
14+
# # print(tempreature)
15+
16+
17+
# import pandas
18+
19+
# data = pandas.read_csv('weather_data.csv')
20+
# # print(data['temp'])
21+
# # temp_list = data['temp'].tolist()
22+
23+
# # max_temp = data['temp'].max()
24+
# # # print(data[data.temp == max_temp])
25+
26+
# # monday = data[data.day == "Monday"]
27+
# # print(monday.temp * (9/5) +32)
28+
29+
30+
# #creating dataframe from scratch
31+
# data_dict = {
32+
# "students":["amy","james","angela"],
33+
# "scores": [76,56,65],
34+
# }
35+
36+
# data = pandas.DataFrame(data_dict)
37+
# print(data)
38+
39+
# data.to_csv("new_data.csv")

day-25/new_data.csv

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
,students,scores
2+
0,amy,76
3+
1,james,56
4+
2,angela,65

day-25/squirrel_census.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pandas
2+
3+
data = pandas.read_csv("Squirrel_Census.csv")
4+
grey =len(data[data["Primary Fur Color"]=="Gray"])
5+
red =len(data[data["Primary Fur Color"]=="Cinnamon"])
6+
black =len(data[data["Primary Fur Color"]=="Black"])
7+
8+
squirrel_dict = {
9+
"Fur Color":["grey","red","black"],
10+
"Amount":[grey,red,black]
11+
}
12+
13+
print(squirrel_dict)
14+
15+
new_squirrel_data = pandas.DataFrame(squirrel_dict)
16+
print(new_squirrel_data)
17+
18+
new_squirrel_data.to_csv("Squirrel Color Count.csv") #new file name
19+
20+
21+
22+
# Alternate solution
23+
# grey =0
24+
# cinnamon = 0
25+
# black = 0
26+
27+
# for color in colors:
28+
# if color == "Gray":
29+
# grey +=1
30+
# elif color == "Cinnamon":
31+
# cinnamon +=1
32+
# elif color == "Black":
33+
# black +=1
34+
35+
# # print (grey,cinnamon,black)

day-25/us-states-game/50_states.csv

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
state,x,y
2+
Alabama,139,-77
3+
Alaska,-204,-170
4+
Arizona,-203,-40
5+
Arkansas,57,-53
6+
California,-297,13
7+
Colorado,-112,20
8+
Connecticut,297,96
9+
Delaware,275,42
10+
Florida,220,-145
11+
Georgia,182,-75
12+
Hawaii,-317,-143
13+
Idaho,-216,122
14+
Illinois,95,37
15+
Indiana,133,39
16+
Iowa,38,65
17+
Kansas,-17,5
18+
Kentucky,149,1
19+
Louisiana,59,-114
20+
Maine,319,164
21+
Maryland,288,27
22+
Massachusetts,312,112
23+
Michigan,148,101
24+
Minnesota,23,135
25+
Mississippi,94,-78
26+
Missouri,49,6
27+
Montana,-141,150
28+
Nebraska,-61,66
29+
Nevada,-257,56
30+
New Hampshire,302,127
31+
New Jersey,282,65
32+
New Mexico,-128,-43
33+
New York,236,104
34+
North Carolina,239,-22
35+
North Dakota,-44,158
36+
Ohio,176,52
37+
Oklahoma,-8,-41
38+
Oregon,-278,138
39+
Pennsylvania,238,72
40+
Rhode Island,318,94
41+
South Carolina,218,-51
42+
South Dakota,-44,109
43+
Tennessee,131,-34
44+
Texas,-38,-106
45+
Utah,-189,34
46+
Vermont,282,154
47+
Virginia,234,12
48+
Washington,-257,193
49+
West Virginia,200,20
50+
Wisconsin,83,113
51+
Wyoming,-134,90
40.2 KB
Loading
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
,0
2+
0,Arizona
3+
1,California
4+
2,Colorado
5+
3,Connecticut
6+
4,Delaware
7+
5,Florida
8+
6,Georgia
9+
7,Hawaii
10+
8,Idaho
11+
9,Illinois
12+
10,Indiana
13+
11,Iowa
14+
12,Kansas
15+
13,Kentucky
16+
14,Louisiana
17+
15,Maine
18+
16,Maryland
19+
17,Massachusetts
20+
18,Michigan
21+
19,Minnesota
22+
20,Mississippi
23+
21,Missouri
24+
22,Montana
25+
23,Nebraska
26+
24,Nevada
27+
25,New Hampshire
28+
26,New Jersey
29+
27,New Mexico
30+
28,New York
31+
29,North Carolina
32+
30,North Dakota
33+
31,Oklahoma
34+
32,Oregon
35+
33,Pennsylvania
36+
34,Rhode Island
37+
35,South Carolina
38+
36,South Dakota
39+
37,Tennessee
40+
38,Utah
41+
39,Vermont
42+
40,Virginia
43+
41,Washington
44+
42,West Virginia
45+
43,Wisconsin
46+
44,Wyoming

day-25/us-states-game/main.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import turtle
2+
import pandas
3+
from state_move import State_m
4+
score = turtle
5+
screen = turtle.Screen()
6+
screen.title("U.S. States Game")
7+
image = "blank_states_img.gif"
8+
screen.addshape(image)
9+
turtle.shape(image)
10+
11+
states_data = pandas.read_csv('50_states.csv')
12+
state_name = states_data.state
13+
states_to_learn = []
14+
guessed_states = []
15+
answerd_state = []
16+
while len(guessed_states) < 50:
17+
answer_state = screen.textinput(title=f"{len(guessed_states)}/{len(state_name)} Guess the state", prompt="What's another state's name?").title()
18+
if answer_state == "Exit":
19+
break
20+
if answer_state not in state_name.values:
21+
print("Invalid state! Try again.")
22+
continue
23+
24+
#If valid, proceed to get the coordinates
25+
answerd_state.append(answer_state)
26+
x_place = int(states_data[states_data["state"] == answer_state].x.iloc[0])
27+
y_place = int(states_data[states_data["state"] == answer_state].y.iloc[0])
28+
29+
guessed_states.append(answer_state)
30+
31+
state_label = State_m(answer_state, x_place, y_place)
32+
33+
34+
for state in states_data.state:
35+
if state not in answerd_state:
36+
states_to_learn.append(state)
37+
pandas.DataFrame(states_to_learn).to_csv("learn_states.txt")

day-25/us-states-game/state_move.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from turtle import Turtle
2+
3+
class State_m(Turtle):
4+
def __init__(self,state_name,x_coord,y_coord):
5+
super().__init__()
6+
self.hideturtle()
7+
self.penup()
8+
self.color('black')
9+
self.goto(x=x_coord,y=y_coord)
10+
self.write(f"{state_name}")

day-25/weather_data.csv

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
day,temp,condition
2+
Monday,12,Sunny
3+
Tuesday,14,Rain
4+
Wednesday,15,Rain
5+
Thursday,14,Cloudy
6+
Friday,21,Sunny
7+
Saturday,22,Sunny
8+
Sunday,24,Sunny

0 commit comments

Comments
 (0)