Please find the Code below
______________________
a. function is written with name check_boundary
b. Below is the code to apply the function to each member of the list
L <- list(2,4,5,6,7,8,4,3)
X <- 5
check_boundary <- function(arg_1,X) {
if(arg_1 > X){
print("S")
}else{
print("B")
}
}
for(val in L){
check_boundary(val,X)
}
Output
______

Modified Function so it will accept the sequence in its parameters
_____________________________________
X <- 5
check_boundary <- function(arg_1,X) {
for(val in arg_1){
if(val > X){
print("S")
}else{
print("B")
}
}
}
check_boundary(seq(2,10),X)
Output
______

Assume you have a list L whose members are different stock values. Write a function in...
In this problem, you should write one function named copy and increment. This function will have one parameter, which you can assume will be a list of integers. This function should return a copy of the parameter list, in which each number from the parameter list has been increased by 1. The function should not modify the values in the parameter list. For example, the code: values - 20, 40, 10, 60, 77, 2) other copy and incrementales) print values...
Assume that L is a list of Boolean values, True and False. Write a function longestFalse(L) which returns a tuple (start, end) representing the start and end indices of the longest run of False values in L. If there is a tie, then return the first such run. For example, if L is False False True False False False False True True False False 0 1 2 3 4 5 6 7 8 9 10 then the function would return...
Python 2.7 Write a function cumsum() that takes a list l as argument and returns the cumulative sum (also known as the prefix sum) of l, which is a list, say cs of the same length as l such that each element cs[i] is equal to the sum of the first i + 1 elements of l, i.e., cs[i] == l[0] + l[1] + l[2] + ... + l[i] You should not modify the argument list l in any way....
#Write a function called next_fib. next_fib should take #have two parameters: a list of integers and a single integer. #For this description, we'll call the single integer n. # #next_fib should modify the list to add the next n pseudo- #Fibonacci numbers to the end of the sequence. A pseudo- #Fibonacci number is the sum of the previous two numbers in #the sequence, but in our case, the previous two numbers may #not be the original numbers from the Fibonacci...
write the following code in python 3.2+. Recursive function
prefered. Thank you!
Define a function named q3() that accepts a List of characters as a parameter and returns a Dictionary. The Dictionary values will be determined by counting the unique 3 letter combinations created by combining the values at index 0, 1, 2 in the List, then the values at index 1, 2, 3 and so on. The q3() function should continue analyzing each sequential 3 letter combination and using...
Assignment 5 Class For Basic Complex Number Operations 1. A complex number is of the form a + ib. Let x = a +ib and y = c +id. The operation of adding two complex numbers is: x + y = (a + c)+i(b+d). The operation of subtracting two complex number is: x-y = (a -c)+i(b-d). The operation of multiplying two complex number is: xxy = (ac - bd) +i(bc + ad). The operation of dividing two complex number is:...
Problem 1. Write a Python function times_i_at_odd(L) that takes as arguments a list L and returns a list consisting of the elements of L multiplied by the index number of the element at odd positions. (Use list comprehensions) >>> times_i_at_odd([1,2,3,4,5,6,7,8,9,10]) [2, 12, 30, 56, 90] Problem 2. Write a recursive function sum_cols(grid, n) that takes a list of lists of integers grid and integer n and returns the sum of column n in grid. For example, the call sum_cols([[1,2,3,4], [10,20,30,40],...
Q1)(20p)Write a static member function called
removeLongestRepeatingSegment that takes a String argument. The
method will return a new String by removing the logest segment that
contains consequtively repeating characters.
public static void main(String []args){
String s=”1111222223333311111111444455552222”;
String res= removeLongestRepeatingSegment(s); will return
“11112222233333444455552222”
}
public static String removeLongestRepeatingSegment(String
s){
---------------
Q2)15p)Given a list of objects stored (in ascending order) in a
sorted linked list, implement member method which performs search
as efficiently as possible for an object based on a key....
Python recursive function:
Given an ordered list L. A permutation of L is a rearrangement of its elements in some order. For example (1,3, 2) and (3, 2, 1) are two different permutations of L=(1,2,3). Implement the following function: def permutations (lst, low, high) The function is given a list 1st of integers, and two indices: low and high (lows high), which indicate the range of indices that need to be considered The function should return a list containing all...
Assume you have the following declarations: enum StudentType {BILL, JANE, MARY}; StudentType oneStudent; Write a function, GetName, that will accept a string as a parameter and return the appropriate StudentType. Provide a main function demonstrating the GetName function in use.