ii. Suppose you have to make a game which 3 users can play. Write a function set_details that will ask the user to set their password. Then in main function you have to apply a loop upto 10 iterations in which the random number is generated between the range of 1-3. • Apply switch statement on the above generated random number to call the function of each player's total score. (Hint: You have to make a function for each player.) Now in the total score function the program should ask the user his password. If he enters correct password, then he is capable of entering a number form 1-9 otherwise the function will display wrong password. • • Finally, after terminating from the loop program should display the total numbers of each player.
Q: 4. This function takes 2 parameters, your paycheck and the % tax taken out of the paycheck. // 50%…
A: function taxesSuck(paycheck, taxPercent){ var reduced_paycheck =0; var necessities = 0; var…
Q: a) Write a program of Time conversion into any of the units such as time to seconds or time to…
A: Sample Response: //C++ program of time conversion into any of the units such as time to seconds or…
Q: Write the followings as separate three functions that 1. checks if an integer is five-digit and…
A: Programs: Programs are used for problem-solving and establishing the interaction between the…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: In this problem, we need to design the javascript programming language. Input - three argument…
Q: Write a function, named randomPassword, that generates a random password that takes no parameter. It…
A: randomPassword( ): def randomPassword(): l = random.randint(7, 10) password = "" for i in…
Q: (a) Write a function get_month() that asks the user for a month, using the prompt string "Please…
A: The function is the block of the organized code which is used to perform the specified task.
Q: Write a function print_times_table(factor, max_limit) that prints the times table for factor but…
A: Since you have not asked for the solution in any particular lanaguage, So i will provide the…
Q: 1. Write a program that prompts the user to enter 5 integers and performs the following: i- The…
A: ## As no language is mentioned, we write the code in Python language. def add(n1, n2, n3, n4,…
Q: The following represents sales data of 10 bubble tea stands for a given shift. sales = [45, 49, 55,…
A: NOTE: According to the guidelines, the first 3 questions are answered 1. Python code for the…
Q: A centrifuge, as you probably know, is a laboratory device used to separate fluids based on density.…
A: Algorithm - Design a method with one argument as a string. Now use the below logic to solve the…
Q: 8. Write a function named allEven that takes one positive integer argument n. Your function then…
A: Algorithm: 1. Create method allEven 2. generate n random number in range of 100, if anyone of them…
Q: Define a function named print_inverted_triangle_pattern (number_of_rows) which takes an integer as a…
A: #first lets understand the pattern#let n=5 //number of rows#1st row has 5 1's followed by 0(0*2)…
Q: Problem 2 Mr. Sulaiman AlHarthy is having 13 shops for selling fruits all over Oman. The daily sales…
A: /////**THE FOLLOWING PROGRAM IS CONSTRUCTED IN PYTHON**///// ## defining a function that reads…
Q: The following two functions P1 and P2 that share a variable B with an initial value of 2 execute…
A: Initial value of B is 2. P1() { 1.C=B-1 2.B=2*C } P2() { 3.D=2B 4.B=D-1 }
Q: You are creating a function that manipulates a number. The function has the following requirements:…
A: Suppose we have number like 2.35 or 3.78 Using the function described, the answer should be 2 or 4.…
Q: program5_1.py Write a program that displays a table of ten distance equivalents in miles and…
A: CODE IN PYTHON: import randomdef toKilometers(miles):return miles * 1.60934print("MILES…
Q: C++
A: //import the required header file #include <iostream> using namespace std; //declare the…
Q: a. %3D b. 17. What is the python reserved word that we use in two-way if tests to indicate the block…
A: Below is the complete solution with explanation in detail for the given question.
Q: Write the followings as separate three functions that 1. checks if an integer is five-digit and…
A: Algorithm: Start Read number Define a function sum by passing the number as argument Initialize…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: This C++ program has a user defined function with name profitableGamble().
Q: a function with the name “ten” that takes two arguments. Both arguments are integers, a and b.…
A: NOTE: SINCE THE LANGUAGE OF THE QUESTION IS NOT MENTIONED, I HAVE USED PYTHON FOR THE SOLUTION.…
Q: Write a function that gets a number between 1 and 20 from the user. Return the number. (Use a while…
A: Note: You didn't mention any programming language. So I use C language to write this program. C…
Q: (2) Write a program include two functions, the first is named fact receives one integer and returns…
A: Start Program to get the Sum of series: 1 + x^2/2! + x^4/4! -…. upto nth term Find the factorial…
Q: 1) create food.txt with the following contents turkey 20.80 pie 7.4 stuffing 2.68 2) read the values…
A: C++ program to create file txt and entering the content C++ program to read the text file content
Q: 3) A function called isMagic is written below, your task is to write two of the helper functions…
A: Answer :
Q: Procedure 2. - Define a function named procedure2 () that will be called from main () function, the…
A: #include <stdio.h> void procedure2(int N){ for(int i = 1; i <= N; i++) {…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob* prize > pay;…
A: Algorithm - Design a method with 3 arguments as a number. Now use the below logic to solve the…
Q: http://people.math.sc.edu'girardi m 142/handouts/10sTaylorPolySeries.pdf to create a script that…
A: Algorithm: Start Read x and n value Set m=x Set x = x*(3.1415/180) Implement caculateSin() which…
Q: Please design another function called: multiply_up (int n), which will multiple up from 1 to n, like…
A: The question is on: designing the function multiply_up (int n), which will multiple up from 1 to n,…
Q: Let the sequence a, be defined by 1Sa? – 30a, + 25|, n > 0 with ao - 17 +2 v7 An+1 = 5 Write a…
A: We need to define a method that compute the an as per the given formula.
Q: Python: we usually refer to two floating point numbers as being equal when they are close enough in…
A: The required Python code is given below: import mathdef almost_equal(f1, f2): # function to check…
Q: (Wattan Corporation) is an Internet service provider that charges customers a flat rate of $7.99 for…
A: #include <stdio.h>#include <string.h>#include <stdlib.h>#include…
Q: Checkpoints 1) Include name, e-mail, and lab# as comments in the code and also include code to…
A: Given: Checkpoints 1) Include name, e-mail, and lab# as comments in the code and also include code…
Q: 3) A function called isMagic is written below, your task is to write two of the helper functions…
A: C++ program is given Below
Q: Create a function that takes two dates and returns the number of days between the first and second…
A: In this problem, we need to provide the solution in java Script programming language. Input -…
Q: In Python: Write a function called pizza_cost that returns the cost per square inch of a circular…
A: Code: def pizza_cost(p,d): r=d/2 area=3.14*r*r cost_sqinch=p/area return cost_sqinch def…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: In this problem, we need to design the javascript programming language. Input - two argument…
Q: 3. Use one of the looping options to plot the functions f (x) = ekr for values of k from -3 to 3 and…
A: Note: Answering the given question in python as no language is mentioned and the first question as…
Q: Write a function, named randomPassword, that generates a random password that takes no parameter. It…
A: def randomPassword(): l = random.randint(7, 10) password = "" for i in range(l):…
Q: Write a function print power outputs (dam records) that takes a list of (name, flow, head,…
A: function print_power_outputs(dams): start a for loop from 0 to length of dams in each index assign…
Q: Create a function that takes three arguments prob, prize, pay and returns true if prob * prize >…
A: We need to write a Javascript code for the given scenario.
Q: Below is a version of a function from your reader which has a problem. Fix it. (Do not use smart…
A: your code is given below:
Q: Write a function, named randomPassword, that generates a random password that takes no parameter. It…
A: Please find the answer below :
Q: 3. Factorial a) Define a function named factorial() with a parameter n. This function returns the…
A: Code: def factorial(n): if n == 1: return n return n*factorial(n-1) n =…
Q: Here is a function that is supposed to return True if word (any string) ends with "s" and False…
A: The condition mentioned in definition is for only small ‘s’ . You need to use or for capital ‘S’…
Q: Write a function NewCalculateGrade that takes a double score and uses reference parameter to return…
A: #include<iostream>using namespace std; void NewCalculateGrade(double score, char &g); int…
Q: Write the followings as separate three functions that 1. checks if an integer is five-digit and…
A: TO COUNT THE DIGIT and sum of digit a loop can be used and the number can be divided by 10 and then…
Q: Write a function named pi_multiples() that takes an integer parameter num. This function repeatedly…
A: Use an infinite loop to accept inputs inside the function and we are printing x and result only if…
Step by step
Solved in 2 steps with 1 images
- Pleaser fix the code below: Since functions should do a single logical task, there is no need for the userInputCalc function to collect the info and also do the summary calculations, so move line 61 to line 72. Then, place line 67-72 inside a main() function, and place a call to this function at the end of the program file. Also, fix the names of the menu items (in menu_items) with spaces so they all have the same size. also, there is a simpler way: change {:<15} with {:<20} in lines 22 and 25. Also, use format for the “Subtotal” and “Grand total” (just like you did for “Sales tax” and “Suggested tip”) Also, the $ should go in front of the each amount. PLEASE MAKE THOSE CHANGES IN THE CODE BELOW: SummaryThis program will create a new version of the restaurant ordering programthat uses lists to look up menu items, record the items ordered by the user,and print a full receipt.''' def Menu(menu_items,menu_prices):print("Menu Card")count = 1for i,j in…11. How many times the given function will execute if a call to f(4) is made? void f(int n){ if(n==0) return; f(n-1);}a) Write a program of Time conversion into any of the units such as time to seconds or time to minutes. Create a function called hms_to_secs(), hms_to_minute() that takes three int values—for hours, minutes, and seconds as an arguments, and returns the equivalent time in seconds and minutes respectively. Create a program to execute this function by repeatedly (hint: use do while loop to take repeated inputs from user) obtaining a time value in hours, minutes, and seconds from the user, calling the function, and displaying the value of seconds it returns.
- This is for R Regarding a function, which of the following is not true? A function must contain a return statement. When a function is defined, it must have parentheses. A function can contain a for loop or an if statement. The function keyword is used to create a function.TODO 12 Let's now split our input data X and labels y into a train and test set using the train_test_split() function (docs). Here we'll use the 80-20 split rule where we use 80% of the data for training and 20% for testing. Lastly, we'll seed our split using the random_state keyword argument which will make sure we create the same split every time we run the function. Use the train_test_split() function to get a train and test split. Store the output into X_train, X_test, y_train, and y_test. Pass the required arguments X and y. Further specify we want to use 20% of the training data by setting the test_size keyword argument. Lastly, pass the keyword argument random_state=42 to set the random seed so we get the same split every time we run this code. Print the shape for X_train. Print the shape for y_train. Print the shape for X_test. Print the shape for y_test. # TODO 12.1X_train, X_test, y_train, y_test = todo_check([ (X_train.shape == (413, 29), 'X_train does not have the…Suppose you have to make a game which 3 users can play. Write a function set_details that will ask the user to set their password. Then in main function you have to apply a loop upto 10 iterations in which the random number is generated between the range of 1-3. . Apply switch statement on the above generated random number to call the function of each player's total score. (Hint: You have to make a function for each player.) Now in the total score function the program should ask the user his password. If he enters correct password, then he is capable of entering a number form 1-9 otherwise the function will display wrong password. Finally, after terminating from the loop program should display the total numbers of each player. Note: Solve in c programming language.
- Please write a stored function named which will take two inputs (type, keyword).The keyword is a substring used to search the course name. You must use LIKE for the pattern match. If the type is not 1 or 2, return an error message “Please input a valid type.” If the keyword is empty or null, return an error message “Please input a valid keyword.” If there is no course name contains the keyword, return “No course found that contains keyword: zzz.” where zzzis the input keyword. If type is 1, return all course ID: course name that course name contains the keyword. If type is 2, return all course ID: student ID who took the courses that course name contains the keyword. The return should be in one line and your report format must match the test cases. You need to use group_concat() function to merge multiple rows output into one line.QUESTION 22 Write ONLY the function to do the following: Input a number selected by the user That number MUST be between 10 and 15 The upper and lower range of the answer must be passed as arguments to the function If the number is NOT in the right range, the user MUST be prompted to input the right answer again Return the answer to the calling function when correctPlease assist, I am trying to modify the function so that it checks if the user is trying to register a name that already exists in user.txt, the appropriate message is displayed but it does not loop back to requesting the user to enter a new username. Instead it continues to request a password from the user. Here is what I have so far in Python. # Define a function to register a new user.def reg_user(): while True: if menu == "r": if user_name == "admin" and password == "adm1n": new_user = input("Please enter a new username: ").lower() with open ("user.txt", "r") as new_file: read_file = new_file.readlines() for file in read_file: read_file = file.split(",") if new_user == read_file[0]: print("Invalid input. This user already exists.") new_password = input("Please enter the password for the new user:…
- Write a function named midvalue that is passed three unique int values and returns the one that is in the middle. Thus, midvalue(5,28,14) returns 14.Write a function that asks the user how many Fibonacci num-bers to generate and then generates them. Make sure to ask the user to enter the numberof numbers in the sequence to generate. The Fibonacci sequence is a sequence of num-bers where the next number in the sequence is the sum of the previous two numbers inthe sequence. The sequence looks like this: 1, 1, 2, 3, 5, 8, 13,You could assign your input integer to a variable num by num = int (input ("Howmany numbers that generates?: "))• You have to consider exceptions, such as the input integer is zero, negative num-bers or floats.• Please submit your code and console screenshots to Bartleby. Code contain-ing syntax error will be graded zero.• Example: The prompt asks "How many numbers that generates?" If your input is10, then the function will return a list of 10 integers 1, 1,2,3,5,8, 13, 21, 34, 55Write a function in python that takes an acrostic as the input and will return the secret message to the user. Include optional arguments to state what makes the first line, as well as what position should be used.a) SATOR\nAREPO\nTENET\nOPERA\nROTAS\n1. Use each index position 0 through 4 b)Elizabeth it is in vain you say\t“Love not” – thou sayest it in so sweet a way:\tIn vain those words from thee or L.E.L.\tZantippe’s talents had enforced so well:Ah! If that language from thy heart arise,\tEndymion, recollect, when Luna tried\tTo cure his love – was cured of all beside\tHis folly – pride – and passion – for he died.“An Acrostic” by Edgar Allen Poe