Skip to content

Instantly share code, notes, and snippets.

@Kinetic27
Created March 13, 2022 15:39
Show Gist options
  • Save Kinetic27/7bfe456137bcc50d39a43a69885fbb77 to your computer and use it in GitHub Desktop.
Save Kinetic27/7bfe456137bcc50d39a43a69885fbb77 to your computer and use it in GitHub Desktop.
친구 과제 수동으로 하길래 python 코드로 해줬음
str = """9.794, 3.025, 0.500, 0.201, 1.931
9.524, 2.955, 0.458, 0.173, 1.797
8.850, 2.980, 0.500, 0.194, 1.820
9.324, 2.547, 0.542, 0.348, 2.634
9.596, 2.553, 0.583, 0.335, 2.599
9.890, 2.548, 0.583, 0.375, 2.797
10.082, 1.997, 0.625, 0.497, 3.199
9.166, 2.212, 0.667, 0.410, 2.749
9.454, 1.874, 0.667, 0.472, 2.931
10.972, 3.324, 0.417, 0.202, 2.135
10.612, 3.299, 0.417, 0.204, 1.646
10.066, 3.272, 0.458, 0.198, 1.892
10.240, 2.684, 0.542, 0.336, 2.631
10.858, 2.688, 0.542, 0.389, 2.800
9.594, 2.682, 0.583, 0.379, 2.795
10.880, 2.075, 0.708, 0.574, 3.599
10.362, 2.096, 0.667, 0.538, 3.215
9.914, 1.997, 0.708, 0.542, 3.187
10.880, 3.737, 0.416, 0.227, 2.248
8.934, 3.403, 0.584, 0.317, 2.501
8.258, 3.531, 0.592, 0.298, 2.249
9.564, 3.083, 0.666, 0.554, 3.204
10.112, 2.898, 0.666, 0.560, 3.620
9.198, 2.784, 0.666, 0.508, 3.122
9.904, 2.235, 0.934, 0.748, 4.034
10.378, 2.242, 0.750, 0.702, 3.841
9.814, 2.141, 0.750, 0.682, 3.574"""
arr = str.split("\n")
result = []
for i in range(len(arr)//3):
col = []
s1 = list(map(float, arr[3*i].split(", ")))
s2 = list(map(float, arr[3*i + 1].split(", ")))
s3 = list(map(float, arr[3*i + 2].split(", ")))
for j in range(len(s1)):
col.append((s1[j] + s2[j] + s3[j]) / 3)
result.append(col)
print(result)
for i in range(len(result)):
for j in [0, 1, 4, 3, 2]:
print(round(result[i][j], 5), end=",")
print()
@justini0715
Copy link

아 ㅋㅋ 계산기 직접 두들기게 놔둬야지 ㅋㅋㄹㅃㅃ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment