has some time to start shooting aliens at the beginning of each level each row needs some empty space below itwhich we'll make equal to the height of one alien to find the number of rowswe divide the available space by two times the height of an alien (againif these calculations are offwe'll see it right away and adjust until we have reasonable spacing number_rows available_height_y ( alien_heightnow that we know how many rows fit in fleetwe can repeat the code for creating rowgame_ def get_number_rows(ai_settingsship_heightalien_height)functions py """determine the number of rows of aliens that fit on the screen "" available_space_y (ai_settings screen_height ( alien_heightship_heightnumber_rows int(available_space_y ( alien_height)return number_rows def create_alien(ai_settingsscreenaliensalien_numberrow_number)--snip-alien alien_width alien_width alien_number alien rect alien alien rect alien rect height alien rect height row_number aliens add(aliendef create_fleet(ai_settingsscreenshipaliens)--snip-number_aliens_x get_number_aliens_x(ai_settingsalien rect widthnumber_rows get_number_rows(ai_settingsship rect heightalien rect heightx create the fleet of aliens for row_number in range(number_rows)for alien_number in range(number_aliens_x)create_alien(ai_settingsscreenaliensalien_numberrow_numberto calculate the number of rows we can fit on the screenwe write our available_space_y and number_rows calculations into the function get_ number_rows(uwhich is similar to get_number_aliens_x(the calculation is wrapped in parentheses so the outcome can be split over two lineswhich results in lines of characters or less as is recommended we use int(because we don' want to create partial row of aliens to create multiple rowswe use two nested loopsone outer and one inner loop the inner loop creates the aliens in one row the outer loop counts from to the number of rows we wantpython will use the code for making single row and repeat it number_rows times