Question
Using PYTHON, I need to convert my timeList in seconds to h,m,s. What code do I need to convert correctly using my code listed? My
Using PYTHON, I need to convert my timeList in seconds to h,m,s. What code do I need to convert correctly using my code listed?
My code is as follows:
import statistics
def parse(): a=input("Please enter a data center letter: ") a=a.lower() dc="dc="+a numList=[] timeList=[] file=open("data.Data.txt","r") lines=file.readlines() file.close() for line in lines: wordList=line.lower().split() number=wordList[2] time=wordList[1] if (dc in wordList): numList.append(number) timeList.append(time) #print("DC=A",wordList) numList=[float(i) for i in numList] avg=statistics.mean(numList) #numList.sort() #print (timeList) #print (numList) res2=statistics.median(numList) outliers=outlier(numList,timeList,avg) print("Average= ",avg) print ("Median= ", res2) '''print (outliers)''' return
def mean(aList): return float(sum(aList)) / max(len(aList), 1) def outlier(numList,timeList,avg): outliers={} for each in numList: t=timeList[numList.index(each)] if (each avg*3): outliers[t]= each print("OUTLIER(+): " ,t, "|",each) return outliers
Data.txt location https://drive.google.com/open?id=0B-rrZhXoU7AaZEd3Ymw1SWY5S3M
import statistics def parse() input ("Please enter a data center letter a a lower dc. num List time List file open data do txt "r") file close for line lines line lower split number wordList [2] time wordList. [1] if (dc in word List) numList. append (number) time List. append (time) print ("DC-A Word List) num List [float (i) for i in numList] avg statistics mean (numList) #numList. Sort print (time List) print (numList) res2 statistics. median (numList) outliers outlier (numList, timeList, avg) print "Average avg) print ("Median res2) print (outliers) T 1 1 return def mean (aList) return float (sum (aList) max (len (aList), 1) def outlier (numList, timeList, avg) outliers for each in numList t time List [numL ist. index (each) if (each avg/3) outliers [t] each print ("OUTLIER ,t, l each) figure this out' if (each avg*3) outliers [t] each print ("OUT LIER t, l n,e each) return outliersStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started