Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- DART
- FOR
- Algorithm
- map
- LOWER
- or
- split
- sum
- index
- If
- and
- 위코드
- SQL
- join
- WECODE
- STR
- Python
- list
- enumerate
- js
- decorator
- slice
- range
- len
- iNT
- Sorted
- MAX
- lambda
- count
- 파이썬
Archives
- Today
- Total
코드로 우주평화
1106. Grasshopper - Messi Goals 본문
Messi's Goal Total
Use variables to find the sum of the goals Messi scored in 3 competitions
Information
Messi goal scoring statistics:
Competition Goals
La Liga 43
Champions League 10
Copa del Rey 5
Task
-
Create these three variables and store the appropriate values using the table above:
-
la_liga_goals
champions_league_goals
-
copa_del_rey_goals
-
Create a fourth variable named total_goals that stores the sum of all of Messi's goals for this year.
Solution:
la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
goals = {
"la_liga_goals": la_liga_goals,
"champions_league_goals": champions_league_goals,
"copa_del_rey_goals": copa_del_rey_goals
}
func = lambda x: sum(x.values())
total_goals = func(goals)
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1108. JavaScript Array Filter (0) | 2022.11.09 |
---|---|
1107. I love you, a little , a lot, passionately ... not at all (0) | 2022.11.07 |
1105. Remove exclamation marks (0) | 2022.11.05 |
1104. Sum Mixed Array (0) | 2022.11.04 |
1103. Welcome! (0) | 2022.11.04 |