
a)
function sortStringsDesc(strings) {
strings.sort();
strings.reverse();
}
b)
def addToFront(lst, item):
lst.insert(0, item)
l Question 2 -JS and Python a) Write JavaScript code to create a function called "sortstingsDesc"...
Need to do in Python? Can do in Javascript but not in Python Write a function named "indexed_list" that takes a list as a parameter. Your function should create a new array. Update the newly created list so that it has the same number of entries as the function's input. Assign each entry in the list you created the value of it's index. So the entry at index 0 would have the value 0, the entry at index 1 would...
Please use proper ES6 JAVASCRIPT SYNTAX including using Let & const correctly Create a function called switchLetters that takes a string and an array. *the switchLetters function should accept two arguments , a string and an array. *The function switches letters in the string with a "/" if they are included in the array for example const arr = ['x', 'a', 'h', 'l', 'd' ] replaceLetters('hello', arr) //output: /e//o please do this in javascript es6 syntax
Create a file called Sort.py (note the capitalization). Within that file, write two different Python functions. Each function will take an array of integers as a parameter and sort those integers in increasing order. One will use insertion sort, and the other will use selection sort (described below). Simple functions will suffice here; do not create any classes. Your insertion sort function should be called insertion_sort(arr). Your selection sort function should be called selection_sort(arr). Selection sort must use a while...
Exercise 2
Using javascript (visual studio code)
(a) Write code that creates 5 item objects (records)
(b) Place the five item objects into an array
(c) Write a function that prints an array of your items it has
one parameter an array of items
(d) Write a function that counts items that match some attribute
value.
(e) Write a function that filters an array of items. It has
three parameter an array of item, an attribute name and a value....
Assignment: USING PYTHON Expected submission: TWO (2) Python files, main.py and HelperClasses.py Make a file called HelperClasses and create a class inside it called Helpers Inside Helpers, create 8 static methods as follows: 1.) Max, Min, Standard_Deviation, Mean a.) Each of these should take a list as a parameter and return the calculated value 2.) Bubble a.) This should take a list as a parameter and return the sorted list 3.) Median a.) This should take a list as a...
Write a function called create_basic_pattern(background_colour, size) which takes a background colour code and an integer as parameters and returns a list of strings. The list represents the pattern of a pixel art pattern. For example, consider the following code fragment:pattern \(=\) create_basicThen the function should create a list of strings. The size of the list is 8 . Each element is a string with 8 'y' characters:
create a file homework_part_1.c a) Implement the function initialize_array that receives two parameters: an array of integers and the array size. Use a for loop and an if statement to put 0s in the odd positions of the array and 5s in the even positions. You must use pointers to work with the array. Hint: review pointers as parameters. b) Implement the function print_array that receives as parameters an array of integers and the array size. Use a for statements...
Add JavaScript code in the “find_primeV2.js” to allow users to enter a number, and then based on the number of user enters, to find out how many prime numbers there are up to and including the user inputted number and then display them on the web page. The following are the detailed steps to complete this assignment: Step 1. [30 points] In “find_primeV2.js”, complete isPrime() function by (1) Adding one parameter in function header. That parameter is used to accept...
Write a Javascript function that accepts a string. The function takes the last digit of the ASCII code and returns a string of digits sorted in ascending order. (without using push, sort or other inbuilt function)
Python Question? Write a function called reverse(user_list, num = -1) that takes a list and a number as parameters. The function returns a copy of the list with the first number of items reversed. Conditions: The number parameter must be a default argument. - If the default argument for number is given in the function call, only the first number of items are reversed. - If the default argument for number is not provided in the function call, then the...