Create a function called lists_Sum(lists) that
takes in a list of lists, each element in each...
Create a function called lists_Sum(lists) that
takes in a list of lists, each element in each sublist will be a
number. Your function will return the product of all the numbers in
the inner lists added together.
solve for python
EX. lists_sum ([[2,2],[3,5],[5,8]])
returns 59
Write the function decipher(s, frequencies),
which will decipher a Caesar cipher encrypted string s using the...
Write the function decipher(s, frequencies),
which will decipher a Caesar cipher encrypted string s using the
letter frequencies in frequencies, and return the plaintext string.
Here is a sample of how this function would be used:
if __name__ == '__main__':
# this file path works on my computer.
# you will need to set this path to work on your computer!
f = open('/Users/azs/code/bu/cs108/assignments/romeo.txt')
text = f.read()
f.close()
d = letter_frequencies(text)
s1 = 'h svun aptl h nv pu h...
Write a function count_div5(nested_list) that takes in a
list of lists of integers, and returns a...
Write a function count_div5(nested_list) that takes in a
list of lists of integers, and returns a list of integers
representing how many integers in each sublist of the original were
divisible by 5.
Examples:
>>> count_div5([[5, 3, 25, 4], [46, 7], [5, 10,
15]])
[2, 0, 3]
>>> count_div5([])
[]
>>> count_div5([[-20, 10, 2, 4, 5], [], [5],
[8, 25, 10], [6]])
[3, 0, 1, 2, 0]
In Python:
Sublist of list A is defined as a list whose elements are all
from...
In Python:
Sublist of list A is defined as a list whose elements are all
from list A. For example, suppose list A = [0, 1, 2, 3, 4, 5, 6],
its has many sublists and one of them is [0, 1, 3] because elements
0, 1 and 3 are all contained in list A.
Define a function named returnComplement that accepts two
integer lists as the parameter (one of the list is the sublist of
the other). Suppose names...
Write a PYTHON function called myMax which accepts a LIST of
numbers and returns the maximum...
Write a PYTHON function called myMax which accepts a LIST of
numbers and returns the maximum number in the list. Do NOT use
Python’s built-in function max.
Example: result = myMax([-999000, -1000000, -2000000]);
print(result) #output is -999000
Example: result = myMax([1000000, 1000001, 1000002]);
print(result) #output is 1000002
using dr.racket programing language
If we write a function that tests whether a list contains only...
using dr.racket programing language
If we write a function that tests whether a list contains only
strings, odd numbers, or even numbers, you will notice that the
code that iterates through the list stays the same, with the only
change being the predicate function that checks for the desired
list element. If we were to write a new function for each of the
tests listed above, it would be more error-prone and an example of
bad abstraction. We could write...
convert code from python to cpp
L =
[2,7,4,19,45,16,9,13,8,69,55,11,23,98,14,5,1,3]
#Merging function
def merge(M,N):
merging_list = []...
convert code from python to cpp
L =
[2,7,4,19,45,16,9,13,8,69,55,11,23,98,14,5,1,3]
#Merging function
def merge(M,N):
merging_list = [] //create empty
list to merge the lists M and N
if not M:
//if M is empty list,
m = 0
//set m = 0
else:
m = len(M)
//otherwise, set m = len(M)
if not N:
//if N is empty list,
n = 0 ...
Write the function has duplicate() which takes as input a
vector v and outputs true if...
Write the function has duplicate() which takes as input a
vector v and outputs true if there is a re-
peated element in v and false if there is no repeated
elements. Below is the algorithm which you
should implement.
default output is 0
for elt1 in v:
for elt2 later in v than elt1:
if elt1==elt2, make output 1, break, end
end
end
Checking if elt1==elt2 counts as one step. Setting the output
value also counts as one step....
Write a function, grade(score), which is given
score, and it returns a letter grade — the...
Write a function, grade(score), which is given
score, and it returns a letter grade — the grade for that mark —
according to this scheme:
A: >= 90
B: [80, 90)
C: [70, 80)
D: [60, 70)
F: < 60
The square and round brackets denote closed and open intervals.
A closed interval includes the number, and an open interval
excludes it. So 79.99999 gets grade C, but 80 gets grade B.
Define the main function as follows:
In main,...