Stage small test my job

# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author : "小多肉"
# @Email : [email protected]
"""

Data.log there is a name for the file, the contents of data.log is a comma as a delimiter, and sequentially stores a test
TestID, TestTime, Success (0 Success; 1 failure). Document data are non-negative integers. Please write a program (Any), for all the success
(Success = 0) test, output:
1) print maximum, minimum TestTime;
2) printing average TestTime, retained second decimal place.
data.log content formats as follows:
TestID, TestTime, Success
0,149,0
1,69,0
2,45,0
3,18,1
4,18,1
"" "
DATA_LIST = []
with Open ( '/ the Users / the root / Downloads / data.log '', MODE = 'R & lt', encoding = 'UTF-. 8') AS F:
for in f.readlines Line ():
line_list line.split = ( ',')
data_list.append (line_list )
test_time = []
for I in DATA_LIST [. 1:]:
test_time.append (int (I [. 1]))
len = len (test_time)
Print (DATA_LIST)
print(test_time)
avg = sum(test_time)/len
# VE#T
for n in range(0,len-1):
for j in range(n+1 ,len):
if test_time[j] <test_time[n]:
temp = test_time[n]
test_time[n] = test_time[j]
test_time[j] = temp
print("{},{}".format(test_time[-1],test_time[0]))
print("TesTestTime: %.2f" %avg)

Guess you like

Origin www.cnblogs.com/momoon/p/12147245.html