Zad1 - done
This commit is contained in:
parent
74ee1aff4e
commit
3149b56948
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.zip
|
13
zad1/main.py
13
zad1/main.py
@ -39,21 +39,19 @@ def sample_standard_deviation(lst, lst_mean):
|
|||||||
|
|
||||||
def q1(lst, lst_median):
|
def q1(lst, lst_median):
|
||||||
is_even = len(lst) % 2 == 0
|
is_even = len(lst) % 2 == 0
|
||||||
idx = len(lst)//2 if is_even else len(lst)//2+1
|
idx = len(lst)//2
|
||||||
sorted_list = lst[:idx]
|
sorted_list = lst[:idx]
|
||||||
if is_even:
|
if not is_even:
|
||||||
sorted_list.append(lst_median)
|
sorted_list.append(lst_median)
|
||||||
|
|
||||||
return median(sorted_list)
|
return median(sorted_list)
|
||||||
|
|
||||||
#
|
|
||||||
def q3(lst, lst_median):
|
def q3(lst, lst_median):
|
||||||
is_even = len(lst) % 2 == 0
|
is_even = len(lst) % 2 == 0
|
||||||
idx = len(lst)//2+1 if is_even else len(lst)//2
|
idx = len(lst)//2 if is_even else len(lst)//2+1
|
||||||
sorted_list = lst[idx:]
|
sorted_list = lst[idx:]
|
||||||
if is_even:
|
if not is_even:
|
||||||
sorted_list.insert(0, lst_median)
|
sorted_list.insert(0, lst_median)
|
||||||
|
|
||||||
return median(sorted_list)
|
return median(sorted_list)
|
||||||
|
|
||||||
|
|
||||||
@ -186,7 +184,6 @@ def main():
|
|||||||
petal_width_list.append(float(petal_width))
|
petal_width_list.append(float(petal_width))
|
||||||
species_dict[species] += 1
|
species_dict[species] += 1
|
||||||
|
|
||||||
|
|
||||||
sepal_length_list.sort()
|
sepal_length_list.sort()
|
||||||
sepal_width_list.sort()
|
sepal_width_list.sort()
|
||||||
petal_length_list.sort()
|
petal_length_list.sort()
|
||||||
|
BIN
zad1/ml_195642_zad1.pdf
(Stored with Git LFS)
Normal file
BIN
zad1/ml_195642_zad1.pdf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user