You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def percent_difference(sample1, sample2):
v1 = sample1.average_sentence_length
v2 = sample2.average_sentence_length
#Calculate and return according to the formula (v1 - v2) / ((v1 + v2)/2)
return abs(v1 - v2) / ((v1 + v2)/2)
Really nice job with this function! The only thing I might change about this function is that it should accept an integer instead of the TextSample object so that the function can be used for non-TextSample objects. By changing this funciton to accept an integer it can be used for other purposes except for this project, thus making it more flexible. Of course, this approach is perfect for the purposes of this project, so it is perfectly acceptable. Just a suggestion.
The text was updated successfully, but these errors were encountered:
Really nice job with this function! The only thing I might change about this function is that it should accept an integer instead of the
TextSample
object so that the function can be used for non-TextSample objects. By changing this funciton to accept an integer it can be used for other purposes except for this project, thus making it more flexible. Of course, this approach is perfect for the purposes of this project, so it is perfectly acceptable. Just a suggestion.The text was updated successfully, but these errors were encountered: