CHALLENGE ACTIVITY 6.1.1: Basic function call get_pattern() returns 5 characters. Call get_pattern() twice in a print() statement to return and print 10 characters. Example output: ***** ***** I need help with this. Use Python for this, please
Q: Write a Java program that will call a method (called f) to tabulate the following function. f(x) =…
A: Program to call a function to calculate the value of the function
Q: What is the execution of the following co mport math K-4 Y=math.pow(X,2) print (Y)
A: It is defined as an interpreted, object-oriented, high-level programming language with dynamic…
Q: iterate func s 0 = s iterate func s n = func (iterate func s (n-1)) What is the output of the…
A: see first x is changed to 2x then rest of the things are done
Q: Consider the following program listing and assume it is run as a module. 1 def main() -> None: 2 х3D…
A: EXPLANATION: The first command that gets executed is the outermost line that is the if condition.…
Q: Lion king from the jungles of Hakuna Matata likes random numbers. Let F4(X) be the number of digits…
A: Given Data:
Q: A) What will be the value of x after the following code is executed? int x, y = 4, z = 6; x =…
A: A) The value of x after the given code is executed
Q: 8 Write a python program that will produce Bowditch or Lissajous figures (x(t) vs y(t)) o (x(t) =…
A: Code: from numpy import sin,cos,pi,linspacefrom pylab import plot,show,subplotimport…
Q: Body of functions • GNU recommendations vetoed • Use K&R style - note also deviation from GNU…
A:
Q: What will be the output of the following Python code? explanation ? def sayHello(): print('welocome…
A: Given Program:- What will be the output of the following Python code? explanation ? def…
Q: What is the value stored in X[4] after the following code segment is executed? int X[5] = {5, 13,…
A: We are given a piece of code in C++ and we need to find the value of X[4] after execution of the…
Q: what sequence of numbers would be printed if the following function were executed with the value of…
A: The given code segment is: def xxx (N): print (N) if (N < 5): xxx (N + 2)…
Q: In Python 3.7.4: Write some code that reads a value representing a name into the variable name then…
A: The following is the source code that will print the desired output on the same line itself.
Q: Write a javascript function that has increment of +5 starting with 4 and ends with 134. start 4…
A: GIVEN: Write a javascript function that has increment of +5 starting with 4 and ends with 134. start…
Q: Write a java program to display the total salary of an employee based on the given conditions:…
A: PROGRAM CODE: import java.util.*; // import utility package of javapublic class Main{…
Q: What is the outcome of the following code? int[] a = { 10, 20, 30, 40 }; int[] b = { 50, 60,…
A: int[] a = { 10, 20, 30, 40 }; int[] b = { 50, 60, 70, 80 }; b[3] = a[2]; a[2] = 79;…
Q: Let's modify the program from this section so that the user can supply the interest rate. For very…
A: Step 1: Declare a constant to store initial balance. Step 2: Declare and initialize year to be 0.…
Q: 1. Type the expressions below in python interactively, and try to explain what's happening in each…
A: Refer to step 2 for the answer.
Q: Write a JavaScript function timer(), which implements a countdown timing utility. When calling the…
A: Objective: A function should be written to provide a countdown timing functionality in a web…
Q: What is the value of the following expressions (or ERROR)? 1. __________ s.length() 2. __________…
A: Note: There are multiple questions given in one question. According to the rule, you will get the…
Q: Trace the following program and write the exact output for the following inputs. Explain each…
A: Trace the following program and write the exact output for the following inputs. Explain each…
Q: Write a Javascript function that would accept two numbers and return the swap of two numbers.…
A: the answer is given below:
Q: What is the output of the following program segment? long long num =5; int i; for (i=1; i<3; i++)…
A:
Q: Exercise 4 What is the output of the following Python script? Draw the Call-Return path of the steps…
A: Answer : output of the given python script will be : [2] As its a recursive function, it will…
Q: a) What output will be printed for input value x = 8 ? (b) How many dierent input values x cause…
A: The given code simply adds each bit and get 2^b, and return b + 1, For
Q: If you are not able to specify the output of the above program exactly, explain why.
A: The sample output of the given program is:
Q: Java Write a program whose input is two integers, and whose output is the first integer and…
A: Start input two numbers check if first number is less than second run a while loop and increment by…
Q: Java - Which of (a)–(d) is false? Multiple choice A postfix expression does not require parenthesis…
A: A post fix expression doesn't have parenthesis at all We can convert infix to post fix and post fix…
Q: Write a Java program called Div that takes 2 (two) double command-line arguments as inputs, dividend…
A: A required program is as follows, File name: “Div.java” public class Div { public static void…
Q: Consider an int *a and an int n. If the value of %ecx is a and the value of %edx is n, which of the…
A: To which assembly snippets best corresponds to the C statement return a[n]?
Q: Implement the quadratic_formula() function. The function takes 3 arguments, a, b, and c, and…
A: Below is the modified python code to implement the quadratic equation and find its roots: -…
Q: void foo(int n) { } int i; for (i = 0; i 0) i = 1 / 2;
A:
Q: Consider the following program listing and assume it is run as a module. 1 def main() -> None: 2 х3D…
A:
Q: Write a Java program that will call a method (called f) to caluculate the following function. f(x)…
A: Given:- Write a Java program that will call a method (called f) to calculate the following function.…
Q: Consider the following declarations. In each case, write the English name of the type of x. Example:…
A: (a) int *x[];(b) int (*x)[];(c) double **x;(d) unsigned long int (*x[])[n]; Given the declarations.
Q: Implement a C++ program to develop a class Library. Library contains pile of books as array and each…
A: Programming approach Creating a Class Library which contains the following private data members:…
Q: What would the output if dynamic scoping is used. Consider that execution of the code starts from…
A: There are two types of scoping used while coding: Dynamic and Static Difference between Dynamic…
Q: Consider a Python function: def spam(n): if n <= 1: return 0 else:…
A: Here I written Python code with proper output and SS with explian. I hope you like it. Given…
Q: Hello, im currently trying to figure out how I might make a print function in Mips. Essentially im…
A: Explanation: The first step is to take user input of the data and for that prompt to take user…
Q: Write a JavaScript function timer(), which implements a countdown timing utility. When calling the…
A: Given question has asked to write JavaScript function timer(), which implements a countdown timing…
Q: Write a C++ Program using using classes, that, given a number greater than zero (0), the user will…
A: The complete code is a given below .
Q: Create a Javascript function that takes a numeral (just digits without separators (e.g. 19093…
A: Here, we have to create a Javascript function that takes a numeral (just digits without separators…
Q: 1. Type the expressions below in python interactively, and try to explain what's happening in each…
A: Note :- As per bartleby guideline we are allowed to solve only first question. So i am unable to…
Q: What is the output of the following code (what is printed to the screen): char myFunction2 (int b);…
A: In this code, myFunction2(int b) is defined with a parameter. When the main function will execute,…
Q: hello! can you please help me with my code? i need to get the same expected output. the instructions…
A: INTRODUCTION: Here we need to fill the function in c programming language.
Q: Write a program in C++ to handle the following scenario: Following is a list of tablets available in…
A: We will be developing a C++ program to handle the following scenario of the medicine store
Q: Write a Python program with the following specifications: Write a program to simulate a clothing…
A: Algorithm: Start the program. Read the number of shirts, number of pants, number of hats. Calculate…
Q: Write a program IN JAVA for an instructor whose course has the following policies: Two quizzes,…
A: Algorithm: 1.import scanner class to enter data 2.create a studentrecord class 3.declare necessary…
Q: PYTHON In the following cell, complete the code so that N is returned when the difference between…
A: def good_enough(C,r): """Return the smallest value of N that satisfies true_value -…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- def display(): print("UTAS") def displayNumber(n1, n2): if n1 > n2: return n1 * n2 else: return n1 - n2 def remarks(number): if number>10: return "SCT"; else: return "HCT"; display() print("Output 1\t:",displayNumber(8,5)) print("Output2\t:",remarks(displayNumber(10,5))) Python 3Fix the errors and send the code please // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = 0, y; String array[] = new String[100]; String entry; final String STOP = XXX; StringBuffer message = new StringBuffer("The words in reverse order are\n"); System.out.println("Enter any word\n" + "Enter + STOP + when you want to stop"); entry = input.next(); while(!(entry.equals(STOP))) { array[x] = entry; ++x; System.out.println("Enter another word\n" + "Enter " + STOP + " when you want to stop"); entry = input.next(); } for(y = x - 1; y > 0; ++y) { message.append(array[y]); message.append("\n"); } System.out.println(message) }. After you correct all the errors check the output and make sure the code gives the desired output. EngineeringDepartments = ['Biomedical Engineering', 'Chemical Engineering', 'Civil and Environmental Engineering' 'Electrical and Computer Engineering', 'Materials Science and Engineering' 'Mechanical Engineering', 'School of Computing'] i=0 def print_list(x): while
- The Problem The Mastermind game board game is a code breaking game with two players. One player (your program) becomes the codemaker, the other the codebreaker. The codemaker (your program) creates a 4 digit secret code which is randomly generated by the supplied code below and the codebreaker tries to guess the 4 digit pattern. import randomsecretCode =[]for i in range (0,4): n = random.randint(1,9) secretCode.append(str(n)) print (secretCode) # take this out when you are playing the game for real because it is a secret The secret code pattern generated above will consist of any of the digits 1-9 and can contain multiples of the same digit. Your program should then tells the codebreaker which digits should be in their guess by displaying a sorted list of the digit characters contained in the secret code python list . Use the loopfor digit in sorted(secretCode): #display each digit on the same line for the player to see; there could be duplicate digits in the secret Prompt…bool validPassword=true; cin >> passPhrase;} if (passPhrase.length() <= 4) { validPassword = false; } else { int digitCount=0; for (int i = 0; i < passPhrase.length(); i++) { if (isdigit(passPhrase.at(i))) digitCount++; } if (digitCount > 4) { validPassword=false; } if (validPassword) { cout << "Valid" << endl; } else { cout << "Invalid" << endl; } return 0;} // it still comes up with these errors. Not sure what it is telling me. main.cpp:9:7: error: expected unqualified-id before ‘if’ 9 | if (passPhrase.length() <= 4) { | ^~ main.cpp:13:7: error: expected unqualified-id before ‘else’ 13 | else { | ^~~~2.15 LAB: Musical note frequencies On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12). Given an initial key frequency, output that frequency and the next 4 higher key frequencies. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print(f'{your_value1:.2f} {your_value2:.2f} {your_value3:.2f} {your_value4:.2f} {your_value5:.2f}')
- import java.util.Scanner ; //This program enables the user enters 10 int between -100 and 100 //then a menu is presented to the user to choose an operation to be //performed on the entered numbers. //operations: add all numbers and display their total //display the average of the numbers //find and display all negative numbers //find and display odd numbers //display all numbers in reverse order //display all 5 multiples public class OPonArrays { public static void main (String [] main) { int SIZE = 10; int [] nums= new int [SIZE]; Scanner KB = new Scanner(System.in); // populate the array for(int i = 0; i < 10; i++) { System.out.println("please enter a number between -100 and 100"); nums[i] = KB.nextInt(); } //display all elments for(int i = 0; i < 10; i++) { System .out.println(nums[i]); } fix the errordef print_num_pattern(num1, num2): if num1 <=0: print("0", end="") return print(num1, end="") print_num_pattern(num1 - num2, num2) print(num1, end="") if __name__ == "__main__": num1 = int(input()) num2 = int(input()) print_num_pattern(num1, num2)PROBLEM: When creating account: It should be 6 digit pin. (if there is a letter or not 6 digits were put in, output will say "Please retry. It should be a 6 digit pin."). It should also have an authenticator for the pin and if the inputted pin is wrong show "Invalid Pin. Please try again." and if it is still wrong in 3 tries, it'll say "Too many incorrect tries. Exiting program." CODE: import random import sys class ATM(): def __init__(customer, name, account_number, balance = 0): customer.name = name customer.account_number = account_number customer.balance = balance def account_detail(customer): print("\n-ACCOUNT DETAIL-") print(f"Account Holder: {customer.name.upper()}") print(f"Account Number: {customer.account_number}") print(f"Available balance: Nu.{customer.balance}\n") def deposit(customer, amount): customer.amount = amount customer.balance = customer.balance +…
- int FindSmallestVal() { int num = 0, min = 0; // reads num until the num > 0 while (num <= 0) { cin >> num; // finds the min value in the min,num min = num < min ? num : min; } // returns min return min; }Racket code only please - primeTest It takes as input any positive integer n and returns true if the absolute value of the polynomial 8n2 − 488n + 7243 is a prime number. For example, the invocation (primeTest 5) should return true. - primeTestSeq This takes two arguments, a low bound and an upper bound. It determines what percentage of the integers between the lower bound and the upperbound are, according to primeTest, a prime number. For example, the invocation (primeTestSeq 1 60) should return 100.Java Program ASAP ************This program must work in hypergrade and pass all the test cases.********** Remove the extra space \n from the program. The text files are located in Hypergrade. For test case 1 first display Please enter a string to convert to Morse code:\n then you press Enter it should print out \n. Then for test case 2 it should display Please enter a string to convert to Morse code:\n then you type abc it should print out .- -... -.-. \n For test case 3 first display Please enter a string to convert to Morse code:\n then you type This is a sample string 1234.ENTER it should print put - .... .. ... .. ... .- ... .- -- .--. .-.. . ... - .-. .. -. --. .---- ..--- ...-- ....- .-.-.- \n. This program down below does not pass the test cases as shown in the screenshot I have provided the correct test case as a screenshot too. Please modify it or create a new program so it paases the test cases. Thank you! For test case 1 it wants only Please enter a…