def test_exercice1(): """ Test for Exercice 1 """ S = [1, 10, 100, 1000, 10000] print("Test somme 1111 : ", somme(S)) print("Test somme liste vide : ", somme([])) print("\nTest moyenne 2222.2:", moyenne(S)) print("Test moyenne list vide 0:", moyenne([])) print("\nTest nombre_sup 2 : ", nb_sup(S, 110)) print("Test moyenne_sup : 5500 : ", moy_sup(S, 110)) print("Test val max 10000 : ", val_max(S)) print("Test index max 4 :", ind_max(S))
def afficheHistoGUI(H_list: list): """ Display on console an histogram Keyword argument: H_list -- List of number to display (histogram) """ plt.hist(H_list, align="mid", facecolor='blue', alpha=0.7, histtype="bar") plt.axis([0, len(H_list), 0, val_max((H_list))]) plt.grid(True) plt.show()
def afficheHisto(H_list: list): """ Display on console an histogram Keyword argument: H_list -- List of number to display (histogram) """ print("\n\nHISTOGRAMME :") MAX0CC = val_max(H_list) length = len(H_list) for i in range(MAX0CC, 0, -1): for e in H_list: if e > 0 and e >= i: print(" # ", end="") else: print(" ", end="") print("") for i in range(length): print("|---", end="") print("|") for i in range(length): print(" " + str(i) + " ", end="")