File tree Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1+ import  turtle 
2+ from  turtle  import  Screen , Turtle 
3+ 
4+ import  pandas 
5+ 
6+ screen  =  Screen ()
7+ my_turtle  =  Turtle ()
8+ my_turtle .hideturtle ()
9+ my_turtle .penup ()
10+ screen .title ("U.S. state game" )
11+ image  =  "blank_states_img.gif" 
12+ 
13+ screen .addshape (image )
14+ turtle .shape (image )
15+ 
16+ 
17+ states_data  =  pandas .read_csv ("50_states.csv" )
18+ all_states  =  states_data ["state" ].to_list ()
19+ answered_states  =  []
20+ 
21+ while  len (answered_states ) <  len (all_states ):
22+     ans_state  =  turtle .textinput (f"{ len (answered_states )} { len (all_states )}  ,
23+                                  prompt = "What's another state's name?" ).title ()
24+ 
25+     if  ans_state  ==  "Exit" :
26+         break 
27+     if  ans_state  in  all_states :
28+         answered_states .append (ans_state )
29+         state_row  =  states_data [states_data ["state" ] ==  ans_state ]
30+         row  =  state_row .iloc [0 ]
31+         my_turtle .goto (row ['x' ], row ['y' ])
32+         my_turtle .write (ans_state )
33+ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments