User:Kithira/Course Pages/CSCI 12/Assignment 2/Group 1/Homework 4: Difference between revisions
Content deleted Content added
m →Code:: edited code further and updated the description |
m Replaced deprecated <source> tags with <syntaxhighlight> |
||
(2 intermediate revisions by one other user 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):
Line 15:
val1 = val2
return sumT
</syntaxhighlight>
This code represents the function Summarize, which summarizes each input using <math>|\sqrt{x^2 + y^2 + z^2}{-1}|</math>. Then, these values are summarized for ''i in range(40)'', which gives a value for 1 second. To prevent against data spikes the programs checks the difference between the previous value and the current value, and if the difference is greater than 2 it replaces the current value with the previous value.
==== Core Program ====
<source lang="python">▼
def getData(file):
infile = open(file)
Line 37 ⟶ 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. We determined that our test subject was a moderately active person.
|