Scoreboard Points
Imagine a football league table where each match score must be turned into points for your team. Write a function points that takes a list games with score strings in the form x:y. Award 3 points for a win, 1 point for a draw, and 0 points for a loss, then return the total.
Примеры
Ввод
["1:0", "2:0", "3:0", "4:0", "2:1", "3:1", "4:1", "3:2", "4:2", "4:3"]Вывод
30Ввод
["1:1", "2:2", "3:3", "4:4", "2:2", "3:3", "4:4", "3:3", "4:4", "4:4"]Вывод
10Ввод
["0:1", "0:2", "0:3", "0:4", "1:2", "1:3", "1:4", "2:3", "2:4", "3:4"]Вывод
0Нужно реализовать
def points(games: list[str]) -> int:
Теги
stringslistsmath
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
["1:0","2:0","3:0","4:0","2:1","3:1","4:1","3:2","4:2","4:3"]Expected
302
Input
["1:1","2:2","3:3","4:4","2:2","3:3","4:4","3:3","4:4","4:4"]Expected
103
Input
["0:1","0:2","0:3","0:4","1:2","1:3","1:4","2:3","2:4","3:4"]Expected
04
Input
["1:0","2:0","3:0","4:0","2:1","3:1","4:1","3:2","4:2","4:3","1:1","2:2","3:3","4:4","2:2","3:3","4:4","3:3","4:4","4:4"]Expected
405
Input
[]Expected
06
Input
["1:0","2:0","2:1","3:0","3:1","3:2","4:0","4:1","4:2","4:3"]Expected
30Focus radio
Paused · SomaFM · Fluid