- 2

Can anyone solve Match Results problem in Golang course

10th May 2021, 10:47 AM
Bilal Sikander
Bilal Sikander - avatar
9 Respuestas
+ 11
package main import "fmt" func main() { results := []string{"w", "l", "w", "d", "w", "l", "l", "l", "d", "d", "w", "l", "w", "d"} var a int var b string fmt.Scanln(&b) //results = append (results, results[(len(results)-1)]) results = append (results, b) for _, v := range results { switch { case v == "w": a += 3 case v == "l": a += 0 case v == "d": a += 1 } } fmt.Println(a) } I just solved it😊
18th Aug 2021, 7:24 PM
yervand
yervand - avatar
+ 2
Yervand bro your solution Is working. Thank you sooooo much......
21st Aug 2021, 2:04 PM
Deepesh V
Deepesh V - avatar
+ 2
😊
21st Aug 2021, 3:34 PM
yervand
yervand - avatar
+ 2
package main import "fmt" func main() { results := []string{"w", "l", "w", "d", "w", "l", "l", "l", "d", "d", "w", "l", "w", "d"} var i string fmt.Scanln(&i) results = append(results, i) res := 0 for _, v := range results { switch v { case "w": res += 3 case "l": res += 0 case "d": res += 1 } } fmt.Println(res) // I just solved it😊 }
10th Jul 2022, 9:18 AM
Kitti Wancoita
Kitti Wancoita - avatar
0
what is the code for match results
7th Jul 2021, 11:49 PM
00kLevi
00kLevi - avatar
0
package main import "fmt" func main() { results := []string{"w", "l", "w", "d", "w", "l", "l", "l", "d", "d", "w", "l", "w", "d"} Countpoints := 0 var input string fmt.Scanln(&input) results = append(results, input) for _, i:= range results { if i == "w" { Countpoints += 3 } else if i == "d" { Countpoints += 1 } else { Countpoints = Countpoints } } fmt.Println(Countpoints) }
28th Dec 2021, 11:02 AM
Georgi Valkanov
Georgi Valkanov - avatar
0
package main import "fmt" func main() { results := []string{"w", "l", "w", "d", "w", "l", "l", "l", "d", "d", "w", "l", "w", "d"} var s string fmt.Scanln(&s) results = append(results, s) sum := 0 for _, v := range results { switch v { case "w": sum += 3 case "d": sum ++ } } fmt.Println(sum) }
14th Oct 2022, 12:39 PM
Mohammad Mostafa Shahraki
Mohammad Mostafa Shahraki - avatar
- 3
Many people can but they can help you. No one will give the solution to just copy and paste Or else show your try
10th May 2021, 12:35 PM
Ayush Kumar
Ayush Kumar - avatar
- 3
Hello 💪 The Q&A is just for quest PROGRAMMING question,so dont spam it is annoying We dont do the homerwork of others 👍 Also,check the SoloLearn forum for understand the rules https://www.sololearn.com/discuss/1316935/?ref=app
10th May 2021, 12:58 PM
Katdotbrush
Katdotbrush - avatar