@@ -22,46 +22,123 @@ def country_with_the_most_scheduled_nonscheduled_service_true():
2222 airport_obj = airports ()
2323 result = \
2424 airport_obj .country_with_the_most_scheduled_nonscheduled_service (True )
25- print (result )
25+ print ('*' * 80 )
26+ print (
27+ 'country with most scheduled service airports,(number)' )
28+ print ('{0:>30},({1})' .format (result [0 ], result [1 ]))
29+ print ('*' * 80 )
2630
2731
2832def country_with_the_most_scheduled_nonscheduled_service_false ():
2933 airport_obj = airports ()
3034 result = \
3135 airport_obj .country_with_the_most_scheduled_nonscheduled_service (False )
32- print (result )
36+ print ('*' * 80 )
37+ print (
38+ 'country with most unscheduled service airports,(number)' )
39+ print ('{0:>30},({1})' .format (result [0 ], result [1 ]))
40+ print ('*' * 80 )
3341
3442
35- def country_with_scheduled_service ():
36- pass
43+ def towns_with_airports_within_100_miles_of_Seattle ():
44+ airport_id = 'KSEA'
45+ airport_name = 'Seattle'
46+ airport_obj = airports ()
47+ result = airport_obj .nearby_airports_within_one_degree (airport_id )
48+ print ('*' * 80 )
49+ print (
50+ 'number of towns with airports within 100 miles of ' , airport_name )
51+ print ('{0:>30}' .format (len (result )))
52+ print ('*' * 80 )
3753
3854
3955def home_page ():
40- pass
56+ airport_obj = airports ()
57+ result = airport_obj .airports_with_home_links ()
58+ url = result ["Seattle Tacoma International Airport" ]
59+ airport_obj .open_web_page (url )
4160
4261
4362def lat_long ():
44- pass
63+ airport_obj = airports ()
64+ airport_id = "KSEA"
65+ result = \
66+ airport_obj .nearby_airports_within_one_degree (
67+ airport_id , airport_lat_long = True )
68+ print ('*' * 80 )
69+ print ('Latitude/Longitude of ' , airport_id )
70+ print ('{0:>30}/{1}' .format (result [0 ], result [1 ]))
71+ print ('*' * 80 )
4572
4673
4774def state_country ():
48- pass
75+ airport_obj = airports ()
76+ airport_id = "KSEA"
77+ result = \
78+ airport_obj .nearby_airports_within_one_degree (
79+ airport_id , state_country = True )
80+ print ('*' * 80 )
81+ print ('State-Country of ' , airport_id )
82+ print ('{0:>30}' .format (result [1 ]))
83+ print ('*' * 80 )
4984
5085
5186def elevation_runway ():
52- pass
87+ runway_obj = runways ()
88+ airport_id = "KSEA"
89+ result = \
90+ runway_obj .runway_data_from_csv_file (airport_id , elevation = True )
91+ print ('*' * 80 )
92+ print ('Runway elevations ' , airport_id )
93+ # returned runway names are like 'runway_elevation_runway'
94+ for runway_name in result :
95+ runway = runway_name .split ('_' )
96+ print ('{0}{1:>30}' .format (runway [2 ], result [runway_name ]))
97+ print ('*' * 80 )
5398
5499
55100def wiki ():
56- pass
101+ airport_obj = airports ()
102+ result = airport_obj .airports_with_wiki_pages ()
103+ url = result ["Seattle Tacoma International Airport" ]
104+ airport_obj .open_web_page (url )
57105
58106
59107def land_737 ():
60- pass
108+ # takes 6791 ft of runway to land a 737
109+ landing_737 = 6791.0
110+ landing_flag = False
111+ runway_obj = runways ()
112+ airport_id = 'KSEA'
113+ result = runway_obj .runway_data_from_csv_file (airport_id , length = True )
114+ print ('*' * 80 )
115+ print ('Runway lengths' , airport_id )
116+ print ('Runway name' , ' ' * 10 , 'Runway length' , ' ' * 10 , '737?' )
117+
118+ # returned runway names are like 'runway_elevation_runway'
119+ for runway_length in result :
120+ length = runway_length .split ('_' )
121+ if float (result [runway_length ]) / landing_737 > 1.0 :
122+ landing_flag = True
123+ print ('{0}{1:>30}{2:>17}' .format (
124+ length [2 ], result [runway_length ], landing_flag ))
125+ landing_flag = False
126+ print ('*' * 80 )
61127
62128
63129def runway_length ():
64- pass
130+ runway_obj = runways ()
131+ airport_id = 'KSEA'
132+ result = runway_obj .runway_data_from_csv_file (airport_id , length = True )
133+ print ('*' * 80 )
134+ print ('Runway lengths' , airport_id )
135+ print ('Runway name' , ' ' * 10 , 'Runway length' )
136+
137+ # returned runway names are like 'runway_elevation_runway'
138+ for runway_length in result :
139+ length = runway_length .split ('_' )
140+ print ('{0}{1:>30}' .format (length [2 ], result [runway_length ]))
141+ print ('*' * 80 )
65142
66143
67144def runway_lighted ():
@@ -140,7 +217,7 @@ def get_csv_files_in_current_directory():
140217 " The country with the most airports with scheduled"
141218 " service" )
142219 print ("2."
143- " The country with the most airports with"
220+ " The country with the most airports with "
144221 "unscheduled service" )
145222 print ("3."
146223 " The number of airports that are within 100 miles"
@@ -170,7 +247,7 @@ def get_csv_files_in_current_directory():
170247 {
171248 "1" : country_with_the_most_scheduled_nonscheduled_service_true ,
172249 "2" : country_with_the_most_scheduled_nonscheduled_service_false ,
173- "3" : country_with_scheduled_service ,
250+ "3" : towns_with_airports_within_100_miles_of_Seattle ,
174251 "4" : home_page ,
175252 "5" : lat_long ,
176253 "6" : state_country ,
0 commit comments