Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions us-states-game/50_states.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
state,x,y
Alabama,139,-77
Alaska,-204,-170
Arizona,-203,-40
Arkansas,57,-53
California,-297,13
Colorado,-112,20
Connecticut,297,96
Delaware,275,42
Florida,220,-145
Georgia,182,-75
Hawaii,-317,-143
Idaho,-216,122
Illinois,95,37
Indiana,133,39
Iowa,38,65
Kansas,-17,5
Kentucky,149,1
Louisiana,59,-114
Maine,319,164
Maryland,288,27
Massachusetts,312,112
Michigan,148,101
Minnesota,23,135
Mississippi,94,-78
Missouri,49,6
Montana,-141,150
Nebraska,-61,66
Nevada,-257,56
New Hampshire,302,127
New Jersey,282,65
New Mexico,-128,-43
New York,236,104
North Carolina,239,-22
North Dakota,-44,158
Ohio,176,52
Oklahoma,-8,-41
Oregon,-278,138
Pennsylvania,238,72
Rhode Island,318,94
South Carolina,218,-51
South Dakota,-44,109
Tennessee,131,-34
Texas,-38,-106
Utah,-189,34
Vermont,282,154
Virginia,234,12
Washington,-257,193
West Virginia,200,20
Wisconsin,83,113
Wyoming,-134,90
Binary file added us-states-game/blank_states_img.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions us-states-game/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

import turtle
import pandas as pd
weather_infor = pd.read_csv('weather.csv')
#
#
# max_val= weather_infor['temp'].max()
# condition = weather_infor['condition'].tolist()
# row = weather_infor[weather_infor.temp ==max_val]
# print(row)#this returns the row that has the biggest temp
#
# data_dict = {
# "students": ["amy","james",'angela'],
# "scores":[12,14,17]
# }
# data = pandas.DataFrame(data_dict)
# data.to_csv('new_data.csv')

scr = turtle.Screen()
scr.title('US STATES GAMES')

image = "blank_states_img.gif"
scr.addshape(image)
turtle.shape(image)
#get the x and y values from csv int a tuple (x,y)
#ask the user for name of the state -- the key is
#name of the state and the value is the (x,y)
#if user types the state correctly the name of the
#state is goes to its values

states =pd.read_csv('50_states.csv')
#keys are state x y
# print(states['state

state = states['state']
x_cor = states['x']
y_cor = states['y']
guessed_state = []
missing_states = []


while len(guessed_state)<50:
answer_state = scr.textinput(title=f'{len(guessed_state)/50} correct state', prompt="WHAT'S ANOTHER STATE'S NAME?")

if answer_state.title() in state.tolist():
t = turtle.Turtle()
t.hideturtle()
t.penup()
state_data = states[states.state == answer_state]
t.goto(int(state_data['x']),int(state_data['y']))
t.write(state_data.state.item())




scr.exitonclick()
8 changes: 8 additions & 0 deletions us-states-game/weather.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
day,temp,condition
Monday,12,Sunny
Tuesday,14,Rain
Wendsday,15,Rain
Thursday,14,Cloudy
Friday,21,Sunny
Saturday,22,Sunny
Sunday,24,Sunny