Here's the code to loop over the different sports branches, extract the rows only for each sport, add a bar for the "Weight" mean with std y error bar, set the y-label and x-tick labels, and save the figure to file:
```python
fig, ax = plt.subplots()
# Loop over the different sports branches
for sport in sports:
# Extract the rows only for this sport
sport_df = summer_olympics[summer_olympics["Sport"] == sport]
# Add a bar for the "Weight" mean with std y error bar
ax.bar(sport, sport_df["Weight"].mean(), yerr=sport_df["Weight"].std())
ax.set_ylabel("Weight")
ax.set_xticklabels(sports, rotation=90)
# Save the figure to file
plt.savefig("sports_weights.png", dpi=300)
```
We use a for loop to iterate over the different sports branches. Inside the loop, we extract the rows only for the current sport using `summer_olympics[summer_olympics["Sport"] == sport]` and assign it to the variable `sport_df`. We then add a bar for the "Weight" mean with std y error bar using `ax.bar(sport, sport_df["Weight"].mean(), yerr=sport_df["Weight"].std())`.
After the loop, we set the y-label using `ax.set_ylabel("Weight")` and the x-tick labels using `ax.set_xticklabels(sports, rotation=90)`. Finally, we save the figure to file using `plt.savefig("sports_weights.png", dpi=300)`.