User:Kithira/Course Pages/CSCI 12/Assignment 2/Group 1/Homework 4: Difference between revisions
Content deleted Content added
→Code:: edited programs |
m Replaced deprecated <source> tags with <syntaxhighlight> |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1:
==Final Project ==
'''by: Christopher Chandler, Ashley Kim, Marina Chaves Caldieraro ====
▲<source lang="python">
from math import sqrt, pow
def summarize(x, y, z):
sumT = 0
val1 = 0
for i in range(40):
sumT = sumT + val2
val1 = val2
return sumT
</syntaxhighlight>
This code represents the function Summarize, which summarizes
==== Core Program ====
▲This code represents the function Summarize, which summarizes the quarter seconds using |(sqrt (x^2 + y^2 + z^2)-1|. Then, these values are summarized for i in range(40), which gives a value for 1 minute.
<
def getData(file):
infile = open(file)
Line 27 ⟶ 34:
row = line.split(",")
res = summarize(float(row[1]), float(row[2]), float(row[3]))
▲ if res > 5.0:
▲ res = 0
lis = lis + res
ave = lis/60.0
Line 34 ⟶ 39:
return total
print getData("/usr/local/share/cs12/Test1.csv")
</syntaxhighlight>
The second part of code is responsible for averaging the values over a minute then adding all the minutes over the course of a week to find a total result that determines the intensity classification
|