Skip to content

Commit cb8551f

Browse files
committed
modify format
1 parent 9b47b21 commit cb8551f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

average_score.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77

88
#解决(python)
99

10-
;#! /usr/bin python
11-
;#coding:utf-8
12-
;
13-
;
14-
;from __future__ import division #实现精确的除法,例如4/3=1.333333
15-
;import random
16-
;
17-
;def make_score(num):
18-
; score = [random.randint(0,100) for i in range(num)]
19-
; return score
20-
;
21-
;def less_average(score):
22-
; num = len(score)
23-
; sum_score = sum(score)
24-
; ave_num = sum_score/num
25-
; less_ave = [i for i in score if i<ave_num]
26-
; return len(less_ave)
27-
;
28-
;if __name__=="__main__":
29-
; score = make_score(40)
30-
; print "the number of less average is:",less_average(score)
31-
; print "the every socre is[from big to small]:",sorted(score,reverse=True)
10+
#! /usr/bin python
11+
#coding:utf-8
12+
13+
14+
from __future__ import division #实现精确的除法,例如4/3=1.333333
15+
import random
16+
17+
def make_score(num):
18+
score = [random.randint(0,100) for i in range(num)]
19+
return score
20+
21+
def less_average(score):
22+
num = len(score)
23+
sum_score = sum(score)
24+
ave_num = sum_score/num
25+
less_ave = [i for i in score if i<ave_num]
26+
return len(less_ave)
27+
28+
if __name__=="__main__":
29+
score = make_score(40)
30+
print "the number of less average is:",less_average(score)
31+
print "the every socre is[from big to small]:",sorted(score,reverse=True)

0 commit comments

Comments
 (0)