Skip to content

Commit 8161087

Browse files
authored
third commit
1 parent ae90b27 commit 8161087

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Karate Club

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def file_load():
1818
file_path = input("Please enter the file path of the text file: ")
1919
text_file = np.loadtxt(file_path) # Load the text file into a Numpy array
2020

21+
print('\n========================================================================\n')
22+
print('The loaded interaction matrix: \n')
2123
print(text_file)
24+
print('\n========================================================================')
2225

2326
return text_file
2427

@@ -51,23 +54,29 @@ def result_of_analysis(text_file, is_symmetry):
5154

5255
number_of_members = text_file.shape[0] # Calculate the number of members in the Karate club
5356
print(f"\nThe number of members in the Karate club: {number_of_members} member(s)\n")
57+
print('========================================================================\n')
5458

5559
interactions_per_member = np.sum(text_file, axis=1) # Calculate the number of interactions for each member
5660
print(f"The number of interactions each member of the club had: {interactions_per_member}\n")
61+
print('========================================================================\n')
5762

5863
most_active_member = np.where(interactions_per_member == np.max(interactions_per_member))[0] # Find the indices of the most active members
5964
most_active_interactions = np.max(interactions_per_member) # Find the maximum number of interactions
6065
print(f"The indices of the most active members and the number of interactions: Indices {most_active_member} / {int(most_active_interactions)} time(s)\n")
66+
print('========================================================================\n')
6167

6268
least_active_member = np.where(interactions_per_member == np.min(interactions_per_member))[0] # Find the indices of the least active members
6369
list_active_interactions = np.min(interactions_per_member) # Find the minimum number of interactions
6470
print(f"The indices of the least active members and the number of interactions: Indices {least_active_member} / {int(list_active_interactions)} time(s)\n")
71+
print('========================================================================\n')
6572

6673
average_of_interactions = np.mean(interactions_per_member) # Calculate the average of the number of interactions across all the members
6774
print(f"The average of the number of interactions: {average_of_interactions}\n")
75+
print('========================================================================\n')
6876

6977
std_of_interactions = np.std(interactions_per_member) # Calculate the standard deviation of the number of interactions across all the members
7078
print(f"The standard deviation of the number of interactions: {std_of_interactions}\n")
79+
print('========================================================================\n')
7180

7281

7382
def main():
@@ -78,7 +87,7 @@ def main():
7887
text_file = file_load()
7988

8089
true_or_false = is_symmetry(text_file)
81-
90+
8291
result_of_analysis(text_file, true_or_false)
8392

8493

0 commit comments

Comments
 (0)