Write a function which finds your group for this exam. The name of the function should be MyGroup, it should has one input argument (x) and one output argument (y). The input argument (x) is your student id as an integer. The output argument (y) is your group as a character. Examples: x = 240209012 , y = "1" x = 300301089 , y = "2"| x = 290304072 , y = "1"
Q: Write a function prime() that returns 1 if its argument is a prime number and returns 0 otherwise.
A: Prime number is a number which is divide by itself only Prime(int a) is the function name where we…
Q: This challenge is based on the classic videogame "Snake". Assume the game screen is an n * n square,…
A: In this problem, we need to design the code in the Python programming language. Input - Integer…
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: function findBrokenKeys(str1, str2) { var brokenLetters = []; for (var i=0; i<str1.length; i++) {…
Q: Which of the following statements is true? A function: a. can have the same definition set as value…
A: Here is the explanation regarding all the options.
Q: Each function (function name plotNegXSquaredPlus25) should accept two integer parameters indicating…
A: Below is the compiled code in java. In the below step you can find the running code and output.…
Q: Write a function validate_date(date_string) which takes in a datestring and checks if the datestring…
A: Given The answer is given below.
Q: Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student…
A: #include <iostream> #include<cmath> using namespace std; double gradeCalc(int a1, int…
Q: Write a function that takes a "CustomerID" and returns a JSON list of product names and their total…
A: Note: Answering the question in python as no programming language is mentioned. Task : Given the…
Q: Write a function call it "shape" (its name) that accepts the length, and the width of a rectangle,…
A: As no programming language is mentioned, the problem is solved using basic C++
Q: A variable num has been predefined as 8, alongside the following function definitions: def func1():…
A: Answer:- 2
Q: Write the definition of a function named quadratic that receives three double parameters a, b, c. If…
A: The formula for roots of a quadratic equation is
Q: Write a function that will take as parameter the points you obtained for a course and return the…
A: The function is shown below. //function to return the grade letter by using the grade pointschar…
Q: Write a function is_valid_triangle() that gets three parameters that are the lengths of edges of a…
A: Algorithm : is_valid_triangle function Step 1 : checking if sum of any sides of the triangle is…
Q: Write a function called Admission that accepts three parameters: School Score SS (double), Written…
A: Code /******************************************************************************…
Q: Write a program in Python with a function perfectcube(n), which returns True if n is a perfect cube…
A: code:-
Q: Write a function called extractor() that takes a name as a parameter and counts every vowel present…
A: Program: Program is used to provide the instructions, it is used to interact with the computer…
Q: This challenge is based on the classic videogame "Snake". Assume the game screen is an n * n square,…
A: Algorithm - Take input from the user. Now use the below logic - res = 1 count = 0 while…
Q: Create a function which returns the type of triangle, given the side lengths. Return the following…
A: As the programming language is not mentioned here, we are using PYTHON The code and output…
Q: Programming Assign. Unit 5 Part 1 Encapsulate the following Python code from Section 7.5 in a…
A: Given: Programming Assign. Unit 5 Part 1 Encapsulate the following Python code from Section 7.5 in a…
Q: # Modify and use your pseudocode for "Find the average score" from # Day 2 homework to create a…
A: You didn't mentioned the language therefore I have done it in python, java and C++
Q: Write a program that contains a function that displays "Welcome to CS127-8L!" Then, it asks for a…
A: Below i have written program:
Q: Write a program in python with a function perfectcube(n), which returns True if n is a perfect cube…
A: let us see the code:-
Q: You are tasked with writing a small part of a museum's ticketing system. The museum calculates…
A: logic: admissionRate=20 total=0 for i in arr: if i<15:…
Q: Using JS Create a function that finds the maximum range of a triangle's third edge, where the side…
A: Step-1: Start Step-2: Declare variables side1, side2 and take input from user Step-3: Call function…
Q: with Python Write a function that will allow the user to scramble a sentence given a stride, take…
A: Here in this question we have to use python and write a function that will allow the user to…
Q: Rewrite your pay computation with time-and-a-half for overtime and create a function called…
A: Program screenshot in python:
Q: Write a function is_valid_triangle() that gets three parameters that are the lengths of edges of a…
A: Ans-- def is_valid_triangle(a,b,c): if a+b >c and a+c >b and b+c >a: return True…
Q: This is a programming assignment. You can use any programming language. Program a Genetic Algorithm…
A: ANSWER:--
Q: Write a program that reads a list of names and total points for students until -1 is entered. After…
A: Given data is shown below: Write a program that reads a list of names and total points for students…
Q: Write a function named join_words() that does not take any input parameter. It repeatedly asks the…
A: According to the Question below the Solution: Output:
Q: Given a struct Date,please overload the operator + to calculate the addition of two dates. struct…
A: #include <iostream>using namespace std; struct Date{ int year; int month; int day;…
Q: Create a function which returns the type of triangle, given the side lengths. Return the following…
A: IN this problem we need to design the code in the RUBY programming language. Please find the logic…
Q: When you could use a symbolic constant instead of a formal parameter to bring data into a function,…
A: Introduction: The following explanation is based on the C++ programming language.
Q: Write a function in "Racket" that takes as an argument a struct and updates the price field by…
A: Racket is a general-purpose, multi-paradigm programming language based on the Scheme dialect of…
Q: In this coding challenge, you will be retrieving email usernames from a string. You will write a…
A: NOTE - I have done the code using the python programming language. Here I defined the method named…
Q: Write a one sentence description of this function and suggest a more descriptive name. int…
A: The given function takes an input of double type as argument and returns a value of integer type. It…
Q: Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student…
A: Please find the answer below:
Q: Write a function get_letter_grade, such that when given * a lab grade score and * a list of the…
A: Here, we have to write the solution in python for the above problem.
Q: Write a program that will: • Select a random number between 1 and 100. • Test if the number is prime…
A: Written code in Python since no programming language was mentioned - from random import *…
Q: Write a function hello(firstname, lastname), which, for example, if called with hello('James,…
A: Hi. Since you have not mentioned any programming language, I will attempt this question using…
Q: Write a one sentence description of this function and suggest a more descriptive name. int…
A: One sentence description:The given function rounds off the value of double "x" to nearest integer…
Q: Make sure you included your ‘docstring’ comments for each function. Add comments for the following…
A: Given Function: function message = str_code_to_message(morse)message='';k=1;for i =1:length(morse)if…
Q: Write a function is_valid_triangle(a,b,c) that gets three parameters that are the lengths of edges…
A: The problem is based on finding the validity of a triangle whose sides are given using python…
Q: This sequence of numbers can start with any positive number n. s is the sum of the individual digits…
A: Solution: Python code: def deadEnd(n): s=0 res=[] c=0 for i in str(n): s +=…
Q: Write a function named findTinyPrimes which will take a positive number M as input and will return…
A: To find the HCF of numbers we use the Euclidean algorithmThis algorithm is based on the fact that…
Q: Write a function named secondLargest() to keep asking the user to enter a series of numbers that…
A: def secondLargest(numbers): lst = numbers.split(" ") lst.sort(reverse=True) #Sort list in…
Matlab:
Please write the codes on matlab, I don't want a manual solution.You can see pic.
Step by step
Solved in 4 steps with 1 images
- Which statement below is true about a function: may have no parameters must always have a return statement must have at least one parameter its arguments always appear within bracketsA teacher is compiling data and needs to find the number of B grades. A B grade is any score greater than 79 and less than 90. If the data is listed in B1 through B210, which function would count the grades correctly? a. =COUNTIFS(B1:B210,>79,B1:B210,<90) b. =COUNTIF(B1:B210,">79") c. =COUNTIFS(B1:B210,">79",B1:B210,"<90") d. =COUNTIFS(B1:B210,">79","<90")Review the DonationTimeLeft function as a group. What value do you think the function will return if it is given 1300 as the argument? Write your answer below. What information do you think will be stored in time_left after calling DonationTimeLeft(1300)? Which lines of code do you think will call the AnnounceDonation function? Write the line numbers below.
- Write a function that takes one double parameter, and returns a char. The parameter represents a grade, and the char represents the corresponding letter grade. If you pass in 90, the char returned will be ‘A’. If you pass in 58.67, the char returned will be an ‘F’ etc. Use the grading scheme on the syllabus for this course to decide what letter to return.Write a program in Python with a function perfectcube(n), which returns True if n is a perfect cube and returns False otherwise. Notice that this function is not printing anything, but rather returning True or False. The function must use exhaustive enumeration to check if n is a perfect cube. Use the function in a program where you ask the user for n and you print a statement like "Yes, that is a perfect cube" or "No, that number is not a perfect cube".Write a function validate_date(date_string) which takes in a datestring and checks if the datestring is valid. If the string is valid, we want to return a tuple containing True and the date_string itself. If the string is invalid for a specific reason, we want to return a tuple containing False and the error code explaining what was wrong with the date string passed in. Below is the error codes for reasons why a string can be invalid (based on criteria on validity, read above): -1 --> date_string does not separate the day, month, and year with slashes. -2 --> day, month, or year are not numeric. -3 --> month out of range (not between 1 and 12) -4 --> day is out of range (not between 1 and last day of the month) For instance, if validate_date(date_string) is called with "01/12/2022" as the argument, the return value is (True, "01/12/2022") because "01/12/2022" is a valid string. If validate_date(date_string) is called with "01/44/2022" as the argument, the return value is…
- To translate a sentence into pig Latin, create a function. When a word is written in pig Latin, its first character is dropped, shifted to the word's tail, and the letters "ay" are added. For instance, "hello world" would be "ellohay orldway" in pig Latin. Your function can be written to presume that each word has at least two letters, that there is one space between each word, and that there are no punctuation marks.There is only 1 ques with 2 part. Please answer the questions ( Answer in python ) Part I: Cities. Write a function called describe_city which accepts the name of a city and its country. The function should print a simple sentence as shown in the output example. Give the parameter for the country a default value. Make 5 calls to the function using the following arguments: Reykjavik, Iceland Pittsburg Ontario, Canada Cairo, Egypt Miami, USA Output Example : ( FOLLOW THE OUTPUT SAME AS GIVEN BELOW ) Reykjavik is in Iceland Pittsburg is in USA Ontario is in Canada Cairo is in Egypt Miami is in USA Part II: Blastoff!!! Write a function called count_down which has 1 integer parameter. The function should countdown from that parameter value to 1. Each step in the countdown should be printed on the same line followed by ‘Blastoff!!!’ also on the same line. All of this should happen in the function. Make 3 calls to the function with the following arguments: 3 5 10 Output…This is a programming assignment. You can use any programming language. Program a GeneticAlgorithm to find an integer number between 0 and 31 that maximizes the function f (x) = x2.The initial procedure is given as below.• Population size: 6• Crossover probability: 100%• Mutation probability: 5%• Terminating criteria:o When your program produces an average of candidates is equal to or greater than29, then you can accept it as a terminating condition.• Fitness function:o You can use the function itself (f (x) = x2)as your fitness function.1. For the 1st generation, you need to print the process and result of selection, crossover, andmutation operation.you need to print the corresponding integer values and bits (binary values)of selection, crossover, and mutation operation. You also need to decide andprint the crossover point and the mutation point.2. From the 2nd generation, you do not have to print all results of selection, crossover,mutation operations. You can just print the result…
- Write a function that asks the user for their birthday month and day and then the function should call a nested function to find out the person’s zodiac sign. Test your program with some user input. Aries: March 21 - April 19 Taurus: April 20 – May 20 Gemini: May 21- June 21 Cancer: June 22- July 22 Leo: July 23 – August 22 Virgo: August 23 – September 22 Libra: September 23 – October 23 Scorpio: October 24 – November 21 Sagittarius: November 22 – December 21 Capricorn: December 22 – January 19 Aquarius: January 20 – February 18 Pisces: February 19 – March 20PYTHON!!! Write a function that receives 3 assignment grades, a1, a2, a3, and a final grade, f, for a student and returns the corresponding letter grade of the student. The weights for the assignments and the final are 0.2, 0.2, 0.2, and 0.4, respectively. You can use the following table for matching grades to letters: 95-100 -> A1 90-94 -> A2 85-89 -> A3 80-84 -> B1 75-79 -> B2 70-74 -> B3 65-69 -> C1 60-64 -> C2 55-59 -> C3 40-54 -> D 0-39 -> F For example, compute_letter(80, 60, 40, 70) returns "C2" because 80 * 0.2 + 50 * 0.2 + 40 * 0.2 + 70 * 0.4 = 62 and 62 corresponds to C2. Note that, you are expected to do rounding. For example, 39.4 is F, whereas 39.5 is D. You can use the builtin round() function for this. Please google this function and learn how to use it. """ def compute_letter(a1, a2, a3, f):2. David is used to doing programming in Python and since the print() function in Python by default prints a newline after printing the string passed to the print() function. But in his current project, he is using PHP programming language and the echo function does not print a newline by default after the end of the string. So, he often misses giving a newline after printing a message. Help David by writing a function myecho() that takes a string as a parameter and also prints a newline after printing the string.