Question: please help fix my code this is the error i get, Test Failed: Failed to import test module: test _ a 1 Traceback ( most

please help fix my code this is the error i get, Test Failed: Failed to import test module: test_a1
Traceback (most recent call last):
File "/usr/lib/python3.10/unittest/loader.py", line 436, in _find_test_path
module = self._get_module_from_name(name)
File "/usr/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/autograder/source/tests/test_a1.py", line 17, in
import assignment1 as a1_student
ModuleNotFoundError: No module named 'assignment1'. I can fix it ill add my code below!# Name:
# OSU Email:
# Course: CS261- Data Structures
# Assignment:Assignment 1
# Due Date:01-29-2024
# Description:Assignment 1
import random
from static_array import *
# ------------------- PROBLEM 1- MIN_MAX -----------------------------------
def min_max(arr: StaticArray)->(int, int):
"""
Write function receives a one-dimensional array of integers and returns a
Python tuple with two values being min and max of the array
"""
minimum = arr.get(0)
maximum = arr.get(0)
for i in range(arr.length()):
if arr.get(i)< minimum:
minimum = arr.get(i)
elif arr.get(i)> maximum:
maximum = arr.get(i)
return (minimum, maximum)
import assignment1 as a1_student
# ------------------- PROBLEM 2- FIZZ_BUZZ ---------------------------------
def fizz_buzz(arr: StaticArray)-> StaticArray:
"""
Function that receives a StaticArray of integers, returns a new StaticArray object
and modifies it by
If number is divisable by 3 element in new array is fizz
If number is divisable by 5 element in new array is buzz
If number is a multiple and 3 and 5, element in new array is fizzbuzz
All other cases element in new array has same value as original array
"""
new_arr = StaticArray(arr.length())
for i in range(arr.length()):
if arr.get(i)%3==0 and arr.get(i)%5==0:
new_arr.set(i, "fizzbuzz")
elif arr.get(i)%3==0:
new_arr.set(i, "fizz")
elif arr.get(i)%5==0:
new_arr.set(i, "buzz")
else:
new_arr.set(i, arr.get(i))
return new_arr
# ------------------- PROBLEM 3- REVERSE -----------------------------------
def reverse(arr: StaticArray)-> None:
"""
Function receives StaticArray reverses order of elements in the array
"""
for i in range(arr.length()//2):
temp = arr.get(i)
arr.set(i, arr.get(arr.length()-1-i))
arr.set(arr.length()-1-i, temp)
# ------------------- PROBLEM 4- ROTATE ------------------------------------
def rotate(arr: StaticArray, steps: int)-> StaticArray:
"""
Function that receives two parameters being StaticArray and integer called steps
Creates new array containing original elements shifted left or right by steps
If steps positive rotate right, left if negative
"""
new_arr = StaticArray(arr.length())
for i in range(arr.length()):
new_index =(i + steps)% arr.length()
new_arr.set(new_index, arr.get(i))
return new_arr
# ------------------- PROBLEM 5- SA_RANGE ----------------------------------
def sa_range(start: int, end: int)-> StaticArray:
"""
Function that receives the two integers start and end and returns StaticArray
containing all consecutive integers start and end 0(N) complexity
"""
arr = StaticArray(end - start +1)
for i, j in enumerate(range(start, end +1)):
arr.set(i, j)
return arr
# ------------------- PROBLEM 6- IS_SORTED ---------------------------------
def is_sorted(arr: StaticArray)-> int:
"""
Function receives StaticArray and returns integer returns array that describes
if array is sorted: 1 if ascending, -1 descending and 0 otherwise
"""
ascending = True
descending = True
for i in range(1, arr.length()):
if arr.get(i)< arr.get(i -1):
ascending = False
if arr.get(i)> arr.get(i -1):
descending = False
if not ascending and not descending:
return 0
return 1 if ascending else -1
# ------------------- PROBLEM 7- FIND_MODE -----------------------------------
def find_mode(arr: StaticArray)->(int, int):
"""
Receives StaticArray sorted in order either non-descending or non-ascending
Returns mode of array and its frequency in that order
"""
max_count =1
current_count =1
mode = arr.get(0)
for i in range(1, arr.length()):
if arr.get(i)== arr.get(i -1):
current_count +=1
if current_count > max_count:
max_count = current_count
mode = arr.get(i)
else:
current_count =1
return (mode, max_count)
# ------------------- PROBLEM 8- REMOVE_DUPLICATES -------------------------
def remove_duplicates(arr: StaticArray)-> StaticArray:
"""
Function receives a StaticArray already

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!