**Background:**
I have this program where the user writes two teams that faced each other and their score and I'm supposed to update a table accordingly. I have all the teams stored as objects with parameters such as name,games,win,goals etc. 

**My problem:**
Is there any way for me to handle both team-inputs and update their respective stats all at once? Right now I'm using 2 different for-loops that basically do the same thing with some minor adjustments.

**My program now (parts of it):**
I use this for loop for the homeTeam and a very similar one for the other team.

```
for i in self.teams:

        if homeTeam.lower() == i.name.lower():
            i.games += 1

            goal_dif_Split = i.goal_dif.split("-")
            goal_dif_Split[0] = int(goal_dif_Split[0])+ scoreH
            goal_dif_Split[1] = int(goal_dif_Split[1])+ scoreA

            i.goal_dif = str(goal_dif_Split[0])+"-"+str(goal_dif_Split[1])

            if scoreH > scoreA:
                i.win += 1
                i.points += 3
            elif scoreH < scoreA:
                i.loss += 1
            else:
                i.tie += 1
                i.points += 1

```

*As requested from the comments:*

**1. This is how the team-inputs look like**:

```
        homeTeam = input ("Hometeam: ")
        awayTeam = input ("Awayteam: ")
        score = input ("Score: ")

```

**2. This is the second for-loop:**

```
     for j in self.teams:

        if awayTeam.lower() == j.name.lower():
            j.games += 1

            goal_dif_Split = j.goal_dif.split("-")
            goal_dif_Split[0] = int(goal_dif_Split[0])+ scoreA
            goal_dif_Split[1] = int(goal_dif_Split[1])+ scoreH

            j.goal_dif = str(goal_dif_Split[0])+"-"+str(goal_dif_Split[1])

            if scoreA > scoreH:
                j.win += 1
                j.points += 3
            elif scoreA < scoreH:
                j.loss += 1
            else:
                j.tie += 1
                j.points += 1

```