Created
June 13, 2019 00:32
-
-
Save Cyborg-Model-Z/46371aeed99d376060fc18ca297ddc60 to your computer and use it in GitHub Desktop.
average_array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input_arrays = [[1, 30, 2], [21, 20, 20], [1, 2, 3]] | |
| def round_down_to_twenty(input_arrays): | |
| for array in input_arrays: | |
| for x in array: | |
| if x >=20: | |
| x = 20 | |
| else: x=x | |
| def average_array(arrays): | |
| nr=0 | |
| for array in input_arrays: | |
| for element in array: | |
| nr=nr+element | |
| print(nr/(len(array))) | |
| nr=0 | |
| average_array(round_down_to_twenty(input_arrays)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-- didn't have 3rd function. Here is my re-work of 1st 2
-- I tried to comment a bit also