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: testa
Traceback most recent call last:
File usrlibpythonunittestloaderpy line in findtestpath
module self.getmodulefromnamename
File usrlibpythonunittestloaderpy line in getmodulefromname
importname
File autogradersourceteststestapy line in
import assignment as astudent
ModuleNotFoundError: No module named 'assignment I can fix it ill add my code below!# Name:
# OSU Email:
# Course: CS Data Structures
# Assignment:Assignment
# Due Date:
# Description:Assignment
import random
from staticarray import
# PROBLEM MINMAX
def minmaxarr: StaticArrayint int:
Write function receives a onedimensional array of integers and returns a
Python tuple with two values being min and max of the array
minimum arr.get
maximum arr.get
for i in rangearrlength:
if arr.geti minimum:
minimum arr.geti
elif arr.geti maximum:
maximum arr.geti
return minimum maximum
import assignment as astudent
# PROBLEM FIZZBUZZ
def fizzbuzzarr: StaticArray StaticArray:
Function that receives a StaticArray of integers, returns a new StaticArray object
and modifies it by
If number is divisable by element in new array is fizz
If number is divisable by element in new array is buzz
If number is a multiple and and element in new array is fizzbuzz
All other cases element in new array has same value as original array
newarr StaticArrayarrlength
for i in rangearrlength:
if arr.geti and arr.geti:
newarr.seti "fizzbuzz"
elif arr.geti:
newarr.seti "fizz"
elif arr.geti:
newarr.seti "buzz"
else:
newarr.seti arr.geti
return newarr
# PROBLEM REVERSE
def reversearr: StaticArray None:
Function receives StaticArray reverses order of elements in the array
for i in rangearrlength:
temp arr.geti
arr.seti arr.getarrlengthi
arr.setarrlengthi temp
# PROBLEM ROTATE
def rotatearr: 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
newarr StaticArrayarrlength
for i in rangearrlength:
newindex i steps arr.length
newarr.setnewindex, arr.geti
return newarr
# PROBLEM SARANGE
def sarangestart: int, end: int StaticArray:
Function that receives the two integers start and end and returns StaticArray
containing all consecutive integers start and end N complexity
arr StaticArrayend start
for i j in enumeraterangestart end :
arr.seti j
return arr
# PROBLEM ISSORTED
def issortedarr: StaticArray int:
Function receives StaticArray and returns integer returns array that describes
if array is sorted: if ascending, descending and otherwise
ascending True
descending True
for i in range arr.length:
if arr.geti arr.geti :
ascending False
if arr.geti arr.geti :
descending False
if not ascending and not descending:
return
return if ascending else
# PROBLEM FINDMODE
def findmodearr: StaticArrayint int:
Receives StaticArray sorted in order either nondescending or nonascending
Returns mode of array and its frequency in that order
maxcount
currentcount
mode arr.get
for i in range arr.length:
if arr.geti arr.geti :
currentcount
if currentcount maxcount:
maxcount currentcount
mode arr.geti
else:
currentcount
return mode maxcount
# PROBLEM REMOVEDUPLICATES
def removeduplicatesarr: 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
