File tree Expand file tree Collapse file tree
utilities/F1-Performance-Analyzer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636 print (f"\n 🏆 { 'Pos' :<4} | { 'Driver' :<20} | { 'Constructor' :<20} | { 'Points' :<6} " )
3737 print ("-" * 60 )
3838 for item in standings [:10 ]: # Top 10 Drivers
39- rank_val = item [ 'position' ]
39+ rank_val = item . get ( next ( k for k in item . keys () if k . startswith ( "pos" ) and not k . endswith ( "Text" )))
4040 driver_name = f"{ item ['Driver' ]['givenName' ]} { item ['Driver' ]['familyName' ]} "
4141 team_name = item ['Constructors' ][0 ]['name' ]
42- score_points = item [ 'points' ]
42+ score_points = item . get ( next ( k for k in item . keys () if k . startswith ( "point" )))
4343 print (f"{ rank_val :<4} | { driver_name :<20} | { team_name :<20} | { score_points :<6} " )
4444 else :
4545 print (f"❌ Error fetching data: Status code { response .status } " )
6060 print (f"\n 🏆 { 'Pos' :<4} | { 'Constructor' :<25} | { 'Nationality' :<15} | { 'Points' :<6} " )
6161 print ("-" * 60 )
6262 for item in standings :
63- rank_val = item ['position' ]
64- team_name = item ['Constructor' ]['name' ]
65- team_country = item ['Constructor' ]['nationality' ]
66- score_points = item ['points' ]
63+ rank_val = item .get (next (k for k in item .keys () if k .startswith ("pos" ) and not k .endswith ("Text" )))
64+ c_info = item ['Constructor' ]
65+ team_name = c_info ['name' ]
66+ team_country = c_info .get (next (k for k in c_info .keys () if k .startswith ("nation" )))
67+ score_points = item .get (next (k for k in item .keys () if k .startswith ("point" )))
6768 print (f"{ rank_val :<4} | { team_name :<25} | { team_country :<15} | { score_points :<6} " )
6869 else :
6970 print (f"❌ Error fetching data: Status code { response .status } " )
You can’t perform that action at this time.
0 commit comments