Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
I need help writing an emacs/lisp function
Write a function that takes two parameters n and m and creating a list of the first m multiples of the number n starting from n. For example,
(make-multiples 3 4)
should return the list
'(3 6 9 12).
Expert Solution
arrow_forward
Step 1
Algorithm :
1. Start
2. Initialize an empty list to store the result.
3. Use a loop to iterate m times.
4. On each iteration, multiply n by 1 plus the iteration number and add the result to the list.
5. Reverse the list and return the result.
6. Stop
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Python. Please solve quickly!!arrow_forwardin haskell: Write a function sumNums that adds the items in a list and returns a list of the running totals. For example: sumNums [2,3,4,5] returns [2,5,9,14].arrow_forwardI am new to Haskell and I need someone to explain the syntax of this function. The function is supposed to take a single integer parameter. It indicates the maximum value of Fibonacci numbers that will be in the list and it uses recursion to generate the list. fibList n = go n 1 1 where go n f s | (f+s) > n = [] | otherwise = (f+s) : go n s (f+s)arrow_forward
- Python please... Implement a function printIndex() that takes a list as a parameter, prompts the user to enter a whole number n, and prints the element in position Index[n]. If the list is empty ([]) or n is not a valid index into the list, the function will not print anything. Be careful to do the correct thing with negative indices. You should assume that the user will enter a whole number when prompted, and the function will crash if the user does not enter an integer. The function should not change the list passed as a parameter. Hint: Just because this involves a list does not mean that you need a loop to solve the problem. Think carefully about the right construct to use here. The following shows the function template, and several examples runs of the function (you must show all the examples with these values in your submission): Template def printIndex(lst): replace with your docstring newList = lst # ________________________ elementNum =…arrow_forwardplease code in pythonWrite a function that takes in a number and returns the sum of all primes less than or equal to that number. You'll need your answer to the previous problem to answer this.Example: sum_primes(11) == 2 + 3 + 5 + 7 + 11 == 28Bonus: Can you do this in one line with a list comprehension?arrow_forwardWrite in c++ pleasearrow_forward
- solve this in pythonarrow_forwardhow to write a function in python 3 that take a tuple t = (7,8,4,20,11) and returns a list which includes all the numbers which are not a prime number.arrow_forwardPlease I need it quickly !!! In python We have a list (named data) of numbers sorted in ascending order, for example: data = [2, 4, 5, 9, 10, 12, 13, 17, 18, 20] Write a function (named DataVar(data)), which take a list (data) as input parameter and performs the following steps on the list: 1) it finds the mean m of the data (for the given example, it is m = (2 + 4 + 5 + 9 + 10 + 12 + 13 + 17 + 18 + 20)/10 =110/10 = 11). 2) then, it finds the difference of data and m. Essentially, it finds for all data: Diff = data-m For the given example, Diff = [-9, -7, -6, -2, -1, 1, 2, 6, 7, 9]. 3) then, it finds the sum of Diff and 7. Essentially, it finds for all data: Sums = Diff+7 For the given example, Sums = [-2, 0, 1, 5, 6, 8, 9, 13, 14, 16]. 4) then, it finds the square of all the elements of Sums, such that Squares = square of the elements of Sums. For the given example, Squares = [4, 0, 1, 25, 36, 64, 81, 169, 196, 256]. 5) it finds the average of Squares and stores it in result, and…arrow_forward
- Use Python when answering the question: Write a function primeFac that computes the prime factorization of anumber: it accepts a single argument, an integer greater than 1 it returns a list containing the prime factorization each number in the list is a prime number greater than 1 the product of the numbers in the list is the original number the factors are listed in non-decreasing order Output is in the attached picture:arrow_forward1.Given the argument passed to the function is a list containing integer values, what does the function return def mystery1(someListOfValues: list):total = 0for value in someListOfValues:total += valuereturn total/len(someListOfValues) 2. The function below is to find the largest value in a list passed by parameter. Does it work as intened (yes or no)? If not give an example of an argument it would not work for. def maxValue(someListOfValues:list):"""returns the largest value the list passed by parameter"""value = 0for num in someListOfValues:if num > value:value = numreturn value 3.Write a function called loadNames() that will open a file called names.txt and build a list of its contents and return it. Function Call: names = loadNames()print(names) Sample ouput: ['Nolan Rafaj\n', 'Brandon Brzuszkiewicz\n', 'Amanda Vozari\n', 'Chase Harper\n', 'Bryce Conner']arrow_forwardI need help Note: It`s a python Implement the following:1) Define a function oddList() with an arbitrary parameter a.2) This function accepts any number of integer arguments.3) oddList() stores all odd numbers into a list and returns the list.4) Call the function with 1, 2, 3, 4, 5 as arguments.5) Print the result of the function call. Make sure to precisely match the output format below.Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course). Example Output[1, 3, 5]arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education