User:Kithira/Course Pages/CSCI 12/Assignment 2/Group 1/Homework 4: Difference between revisions
Content deleted Content added
←Created page with '==Final Project by: Christopher Chandler, Ashley Kim, Marina Chaves Caldieraro== === Code: === <source lang="python"> from math import sqrt, pow def summarize(...' |
m Replaced deprecated <source> tags with <syntaxhighlight> |
||
(5 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):
val1 = 0
for i in range(40):
if abs(val2 - val1) > 2:
return sum(time)▼
val2 = val1
val1 = val2
</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)
for i in range(100):
line = infile.readline()
for i in range(
lis = 0
for i in range(60):
"""avg all values over min"""
Line 26 ⟶ 34:
row = line.split(",")
res = summarize(float(row[1]), float(row[2]), float(row[3]))
total = total +
▲ total = sum(finRes)
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
|