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
Consider the following function.
def factorial(n) :
result = 1
for i in range(1, n + 1) :
result = result * i
return result
What is the parameter for this function? _____
- factorial
- i
- n
- result
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 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
- In c++, Write a function that returns the greatest common divisor of 2 integers.arrow_forwardC programing Given the function below, what would the function call question3(10, 101) return? int question3(int a, int b) {if (a == 0) return b;if (b == 0) return a;return question3(10*a+b%10, b/10);}arrow_forwardWhat benefits can you get from using a function?\arrow_forward
- What is a stub? Group of answer choices A stub is an inline function with a single line that simply sends a "Hello" message to others, indicating that it has been activated. A stub is a function that has an empty body. It will be developed later. A stub is an inline function with a single line that simply increases the pass in value by one. A stub is a function with a single line that simply prints the name of the function, indicating that it has been activated. A stub is a short function that will generate an error message.arrow_forwardDefine stubs for the functions get_user_num() and compute_avg(). Each stub should print "FIXME: Finish function_name)" followed by a newline, and should return -1. Each stub must also contain the function's parameters. Sample output with two calls to get_user_num() and one call to compute_avg(): FIXME: Finish get_user_num() | FIXME: Finish get_user_num() FIXME: Finish compute_avg() Avg: -1 354684.2266598.qx3zgy7 2 Your solution goes here ''' 4 user_num1 5 user_num2 6 avg_result get_user_num() get_user_num) compute_avg(user_num1, user_num2) 8 user_num1 9 user_num2 10 avg_result %3D 11 12 print('Avg:', avg_result)arrow_forwardHello I needed help with this JavaScript function Thanks. function _two(dividend, divisor)Create a JavaScript function that meets the following requirements:• Is passed two integer parameters, one representing a dividend, and the other a divisor.• The function is NOT permitted to use the % (mod) operator• The function can use any combination of +, - , * or / to solve the problem• The function displays the calculated remainder (console log) as illustrated below:• The function returns the result of the calculation back to the caller.arrow_forward
- Options are : F A D X C,E Barrow_forwardHello I needed help with this JavaScript function Thanks. function _two(dividend, divisor)Create a JavaScript function that meets the following requirements:• Is passed two integer parameters, one representing a dividend, and the other a divisor.• The function is NOT permitted to use the % (mod) operator• The function can use any combination of +, - , * or / to solve the problem• The function displays the calculated remainder (console log) as illustrated below:• The function returns the result of the calculation back to the caller.arrow_forwardwrite a function sumValues which has two formal paramerters. int num1 and int num2. The function sums the values from num1 to num2 inclusive and returns the sumarrow_forward
- Refactor the following code using the concept of functions. a = 2 b = 3 C= 4 d = 5 a = 2 b = 3 C= 4 d = 5arrow_forwardUsing C++ Language In this program you will write a function of void return type named compare that accepts an integer parameter named guess. This function will compare the value of guess with a seeded randomly generated integer between 1 to 100, inclusive, and let the user know what the random number was as well as whether the guess was larger than, smaller than or equal to the random number. NOTE THAT: You will NOT generate a random number inside the compare function. Rather, you will write another function named getRandom of int return type to do it. You will need to call getRandom from compare, no parameters are necessary. Inside your main function, get the guess from user and pass it to the compare function. Code: #include <iostream>using namespace std; int getRandom(){ //generate seeded random num. //in between 1-100 inclusive //return random number } void compare(int guess){ //call getRandom //compare guess with random number //inform user what…arrow_forwardComplete the code that returns the value of f(x), which has the value 1 inside the range −1 ≤ x ≤ 1 otherwise it is the value 0. f(x) [ ] # complete the function to return the value of 1, x = [-1, 1] 0, otherwise #f(x) given x. # return as the value called variable def function_f(x): # YOUR CODE HERE return fval "fval" ## Check your code below using print command ← → +0 0+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