Best Python code snippet using avocado_python
opgave7_7.py
Source:opgave7_7.py
1def get_number_of_participants(tabel_list):2 return len(tabel_list[0])3def get_number_of_tests(tabel_list):4 return len(tabel_list)5def highest_heart_rate(tabel_list):6 highest = tabel_list[0][0]7 for i in range(len(tabel_list)):8 for j in range(len(tabel_list[i])):9 if tabel_list[i][j] > highest:10 highest = tabel_list[i][j]11 return highest12def lowest_heart_rate(tabel_list):13 lowest = tabel_list[0][0]14 for i in range(len(tabel_list)):15 for j in range(len(tabel_list[i])):16 if tabel_list[i][j] < lowest:17 lowest = tabel_list[i][j]18 return lowest19def average_heart_rate(tabel_list):20 average_list = []21 number_participants = get_number_of_tests(tabel_list)22 for i in range(get_number_of_participants(tabel_list)):23 total = 024 for j in range(number_participants):25 total += tabel_list[i][j]26 average_list.append(int(total / len(tabel_list[0])))27 return average_list28# def get_heart_rate_difference(tabel_list):29# result = []30# number_of_participants = get_number_of_participants(tabel_list)31# number_of_tests = get_number_of_tests(tabel_list)32# for participant in range(number_of_participants):33# highest = tabel_list[0][participant]34# lowest = tabel_list[0][participant]35#36def main():37 tabel_list = [[72, 75, 71, 73, 72, 76],38 [91, 90, 94, 93, 88, 91],39 [130, 135, 143, 142, 129, 138],40 [120, 118, 110, 105, 121, 119]]41 print("Number of participants per test:", get_number_of_participants(tabel_list))42 print("Number of tests:", get_number_of_tests(tabel_list))43 print("Highest heart rate:", highest_heart_rate(tabel_list))44 print("Lowest heart rate:", lowest_heart_rate(tabel_list))45 print("Average value per test:", average_heart_rate(tabel_list))46if __name__ == '__main__':...
extra 7.9.py
Source:extra 7.9.py
1def get_number_of_participants(list):2 return len(list[0])3def get_number_of_tests(list):4 return len(list)5def highest_heart_rate(list):6 grootste = list[0][0]7 for i in range(len(list)):8 for j in range(len(list[i])):9 if grootste < list[i][j]:10 grootste = list[i][j]11 return grootste12def lowest_heart_rate(list):13 kleinste = list[0][0]14 for i in range(len(list)):15 klrij = min(list[i])16 if kleinste > klrij:17 kleinste = klrij18 return kleinste19def average_heartrate(list):20 average = []21 for i in range(len(list)):22 som = sum(list[i])23 average.append(som/len(list[i]))24 return average25def heartrate_difference(list):26 difference = []27 for j in range(len(list[0])):28 kl = list[0][j]29 gr = list[0][j]30 for i in range(1, len(list)):31 if list[i][j] > gr:32 gr = list[i][j]33 elif list[i][j] < kl:34 kl = list[i][j]35 difference.append(gr-kl)36 return difference37list = [[72, 85, 62, 12, 32, 54],38 [32, 84, 54 ,61 ,32 ,54],39 [45, 78, 96, 62, 31, 13],40 [11, 18, 29, 39, 28, 49]]41print("aantal deelnemers:", get_number_of_participants(list))42print("aantal testen:", get_number_of_tests(list))43print(highest_heart_rate(list))44print(lowest_heart_rate(list))45print(average_heartrate(list))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!