#Python program
def sumSquares(aList):
if not isinstance(aList, list):
return "error"
total=0
for ele in range(0, len(aList)):
if isinstance(aList[ele],int):
total = total + aList[ele]*aList[ele]
return total
aList = [1,'b',3,'a']
print(sumSquares(aList))
#Screenshot

GOALI Using your text editor, write the function sumSquares(aList). The function takes a list as ninput...
Using Python. Write a function clean2(aList) that takes a list of integers aList as argument, and modifies this list, such as multiple occurrences of values have been removed. The procedure does not return a list: it modifies its argument (reference aList). 3 For instance, the following statements: al = [1,2,3,4,4,4,5,1,2,1,5] print(al) clean2(al) print(al) print the following result (a different order of values is acceptable): [1,2,3,4,4,4,5,1,2,1,5] [1,2,3,4,5]
For Python [25 pts] Write the method divisorList(aList, divisor) that takes in a list with elements of any data type and a divisor which is in the form of an integer. The output is a sorted list of only the integers that are divisible by the divisor. Example: divisorList([1, 1, 12, 'a', 90, 34], 2) will return [12, 34, 90] since 12, 90, and 34 are all divisible by two. Note that the returned list is sorted from smallest to...
IN VBA Please 2.Write a function that takes 2 ranges as input and gets the sum of absolute difference of every element if there two ranges have the same numbers of elements. the function can send error message to user if the size of these two ranges are different. the function can take not only 2 ranges but also two arrays as input
Write the function deep_contains. It takes as input a number and a list. That list might contain lists as elements, and those lists might contain lists, etc. The deep_contains' function should return a Boolean indicating whether the number is contained inputted list, or a sublist of it, or a sublist of that, and so forth. For example: deep_contains (3, (1,3,5]) returns True deep_contains(3, 11, [3,5]]) returns True deep_contains (3, 1, [[3,4],5),6]) returns True deep_contains (2, (1,3,5]) returns False This function...
aList = [1, 'Mercy', 20, 'Cyber', 300]. a) Write a single line of Python statement to print the value 20 from aList. b) Write a single line of Python statement to print the character b from aList. c) Write a single line of Python statement to print erc from aList. d) Write a Python segment that print a sequence number starting from 1 followed by ")" and an element for each element of the list. Use a for loop and...
Please write the code in a text editor and explain thank you! 1. LINKED-LIST: Implement a function that finds if a given value is present in a linked-list. The function should look for the first occurrence of the value and return a true if the value is present or false if it is not present in the list. Your code should work on a linked-list of any size including an empty list. Your solution must be RECURSIVE. Non-recursive solutions will...
20. [5 points] Rewrite the following ML. function using patterns fun factn. ifn-0 then 1 else n fact (n-1) 21. [S points) Using map function, write an ML function int2real of type int list real list that takes a list of integers and returns the same numbers converted to real. For example, if the input is [1,2,3], the output should be like [1.0,2.0,3.0 22. [5 points] Using foldr function, write a function duplist of type·a list 'a list that takes...
With using Python . Write a function that: 1. Takes two arguments and returns the product of the arguments. The return value should be of type integer. 2. Takes two arguments and returns the quotient of the arguments. The return value should be of type float. 3. Takes one argument and squares the argument. It then uses the two values and returns the product of the two arguments.(Reuse function in 1.) 4. Takes one argument and prints the argument. Use...
Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function that does the following: Prompts the user, using two input boxes, for the height and the radius of the base of a cone. Calls a function named cone_volume and passes the two values to it. Receives a value back from the function and displays it in a message to the user. Create a function named cone_volume that does the following: Receives the two values...
MATLAB QUESTION Write a MATLAB function called vector_input that takes no inputs and returns no outputs. Instead, when called, it gives control to the user and asks the user to input a length-3 vector. Then the function prints: The sum of ___, ____, and ____ is ____. [new line] where the first three blanks are filled by each element in input vector, and the last blank is the sum of all three elements.