Skip to content

Commit 67051d8

Browse files
add max
2 parents 4c7fa1a + 0f9b86a commit 67051d8

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

hw/week3/.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch test package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "test",
12+
"program": "${workspaceFolder}"
13+
},
14+
]
15+
}

tut/stat/stat.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ import (
1111

1212
type Stats struct {
1313
data []float64
14+
<<<<<<< HEAD
15+
=======
16+
}
17+
18+
func (s *Stats) Add(x ...float64) {
19+
s.data = append(s.data, x...)
20+
}
21+
22+
func (s *Stats) Mean() float64 {
23+
var x float64
24+
x = 0
25+
var i int
26+
for i = 0; i < len(s.data); i++ {
27+
x = x + s.data[i]
28+
}
29+
x = x / float64(len(s.data))
30+
return x
31+
>>>>>>> 0f9b86ae1a2b000d67c9ba77109ccad2af6711d5
1432
}
1533

1634
func (s *Stats) Add(x ...float64) {

0 commit comments

Comments
 (0)