I keep on getting error for the following python code. Please help me resolve this error asap. # SYSC 2100 Winter 2023 Lab 11/Asst 2 import random import time from sort import bubble_sort, selection_sort, insertion_sort, heapsort __author__ = '' __student_number__ = '' __Version__ = '9.0.2' # Your profiling functions can have as many parameters as you want. # The return type of each function is up to you. def generate_random_list(length: int):     return [random.randint(i, 1000) for i in range(length)] def profile_sort_algorithm(sort_function, test_lengths, repetitions):     results = []     for n in test_lengths:         timings = []         for i in range(repetitions):             data = generate_random_list(n)             start_time = time.perf_counter()             sort_function(data)             end_time = time.perf_counter()             timings.append(end_time - start_time)         average_time = sum(timings) / len(timings)         results.append((n, average_time))         print(f"{sort_function.__name__}: n={n}, average_time={average_time}")                  return results def profile_bubble_sort():     print("Profiling bubble sort")     test_lengths = [1000, 1250, 1500, 1750]     repetitions = 10     return profile_sort_algorithm(bubble_sort, test_lengths, repetitions) def profile_selection_sort():     print("Profiling selection sort")     test_lengths = [1000, 1250, 1500, 1750]     repetitions = 10     return profile_sort_algorithm(selection_sort, test_lengths, repetitions) def profile_insertion_sort():     print("Profiling insertion sort")     test_lengths = [1000, 1250, 1500, 1750]     repetitions = 10     return profile_sort_algorithm(insertion_sort, test_lengths, repetitions) def profile_heapsort():     print("Profiling heapsort")     test_lengths = [1000, 1250, 1500, 1750]     repetitions = 10     return profile_sort_algorithm(heapsort, test_lengths, repetitions) if __name__ == '__main__':     n_values = [1000, 1250, 1500, 1750, 2000]     k = 10     bubble_sort_results = profile_bubble_sort(n_values, k)     selection_sort_results = profile_selection_sort(n_values, k)     insertion_sort_results = profile_insertion_sort(n_values, k)     heapsort_results = profile_heapsort(n_values, k)     print_results(bubble_sort_results, "Bubble Sort")     print_results(selection_sort_results, "Selection Sort")     print_results(insertion_sort_results, "Insertion Sort")     print_results(heapsort_results, "Heapsort")

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I keep on getting error for the following python code. Please help me resolve this error asap.

# SYSC 2100 Winter 2023 Lab 11/Asst 2

import random
import time
from sort import bubble_sort, selection_sort, insertion_sort, heapsort

__author__ = ''
__student_number__ = ''
__Version__ = '9.0.2'


# Your profiling functions can have as many parameters as you want.
# The return type of each function is up to you.

def generate_random_list(length: int):
    return [random.randint(i, 1000) for i in range(length)]

def profile_sort_algorithm(sort_function, test_lengths, repetitions):
    results = []

    for n in test_lengths:
        timings = []
        for i in range(repetitions):
            data = generate_random_list(n)
            start_time = time.perf_counter()
            sort_function(data)
            end_time = time.perf_counter()
            timings.append(end_time - start_time)
        average_time = sum(timings) / len(timings)
        results.append((n, average_time))
        print(f"{sort_function.__name__}: n={n}, average_time={average_time}")
        
        return results


def profile_bubble_sort():
    print("Profiling bubble sort")
    test_lengths = [1000, 1250, 1500, 1750]
    repetitions = 10
    return profile_sort_algorithm(bubble_sort, test_lengths, repetitions)


def profile_selection_sort():
    print("Profiling selection sort")
    test_lengths = [1000, 1250, 1500, 1750]
    repetitions = 10
    return profile_sort_algorithm(selection_sort, test_lengths, repetitions)

def profile_insertion_sort():
    print("Profiling insertion sort")
    test_lengths = [1000, 1250, 1500, 1750]
    repetitions = 10
    return profile_sort_algorithm(insertion_sort, test_lengths, repetitions)


def profile_heapsort():
    print("Profiling heapsort")
    test_lengths = [1000, 1250, 1500, 1750]
    repetitions = 10
    return profile_sort_algorithm(heapsort, test_lengths, repetitions)

if __name__ == '__main__':
    n_values = [1000, 1250, 1500, 1750, 2000]
    k = 10

    bubble_sort_results = profile_bubble_sort(n_values, k)
    selection_sort_results = profile_selection_sort(n_values, k)
    insertion_sort_results = profile_insertion_sort(n_values, k)
    heapsort_results = profile_heapsort(n_values, k)

    print_results(bubble_sort_results, "Bubble Sort")
    print_results(selection_sort_results, "Selection Sort")
    print_results(insertion_sort_results, "Insertion Sort")
    print_results(heapsort_results, "Heapsort")

<ERROR>

Python 3.11.2 (v3.11.2:878ead1ac1, Feb 7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)]
Type "help", "copyright", "credits" or "license" for more information.
[evaluate profile.py]
Traceback (most recent call last):
File "/Users/rounakmukherjee/Downloads/profile.py",
line 66, in <module>
=
bubble_sort_results
builtins. TypeError: profile_bubble_sort() takes 0 positional arguments but 2 were given
profile_bubble_sort(n_values, k)
Transcribed Image Text:Python 3.11.2 (v3.11.2:878ead1ac1, Feb 7 2023, 10:02:41) [Clang 13.0.0 (clang-1300.0.29.30)] Type "help", "copyright", "credits" or "license" for more information. [evaluate profile.py] Traceback (most recent call last): File "/Users/rounakmukherjee/Downloads/profile.py", line 66, in <module> = bubble_sort_results builtins. TypeError: profile_bubble_sort() takes 0 positional arguments but 2 were given profile_bubble_sort(n_values, k)
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY