we have a list in Scala :

```
val testList = List("Sita" -> 1, "Sita" -> 2, "Ram" -> 3, "Ram" -> 4, "Shyam" -> 5)

```

I applied this on list to group the values by key in Scala:

```
val res = testList.groupBy(_._1).map { case (k, v) => k -> v.map(_._2).sum }

```

and i got this as a result:

```
Map(Shyam -> 5, Ram -> 7, Sita -> 3)

```

**I want to do the same in python Please help me out:**

```
testList = [("Sita", 1), ("Sita", 2), ("Ram", 3), ("Ram", 4), ("Shyam", 5)]

```

**Edit: And what if i have a list like this:**

```
testList = [("Sita_English", 1), ("Sita_Maths", 2), ("Ram_English", 3), ("Ram_Maths", 4), ("Shyam_English", 5)]

```