human
Considering the provided database schema and associated query, produce SQL code to retrieve the answer to the query. 
###Database Schema: Team, Stadium, Home Games, Average Attendance, Total Attendance, Capacity Percentage
###Question: What was average attendance when total attendance was 541380?
gpt
SELECT Average Attendance FROM table WHERE Total Attendance = 541380