A beginner has tried to write a Python function which takes as input an integer N and returns a list of all integers from 1 to N which are not divisible by 7 and are not perfect cubes. def Perfect Square (N) : for i in range (N): if not i % 7 = 0: print (i) if not i** (1/3) = int(i** (1/3)): print (i) How would you improve this code? (Comment on problems with this function, do not include your own function in your answer.)
Q: void loop() { measureULTRASONIC (); if (distance <= 200) moving_speed= map (distance, 0, 200, 40,…
A: We need to fix the error of the given code. **Since the given code is a hardware specific code,…
Q: Question 2. (a) Give the definition of a tree. Definition. A tree is a graph that ... (b) Give a…
A: A tree is a data structure that is used to store information in a hierarchical way. It consists of…
Q: Categories ALL THE Usability metrics from ISO 9241 regarding error tolerance, learnability, and the…
A: ISO 9241 is a series of international standards that specify guidelines and recommendations for the…
Q: How serious are the issues plaguing the worldwide web of information?
A: A global information system is a technology or information system that tries to give all of the…
Q: Write a function that takes as input a positive integer and returns true if it is prime and false…
A: 1) Below is C++ Program that write a function that takes as input a positive integer and returns…
Q: In your own words, explain the concepts of a path. Give an example of each type of path for the…
A: In computer systems, there various directories are present which hold the number of files in…
Q: Can anyone explain to me as simply as possible what in the world is a "link-state" algorithm?
A: We need to explain the Link State Algorithm.
Q: Write the configurations that the below Turing machine enters for the input string 11. 91 1a, R R 1…
A: An abstract machine that manipulates symbols on a strip of tape in accordance with a set of rules is…
Q: What is the difference between linear_search(O(n)) time complexity, and binary_search(O(nlog2n))…
A: Solution:- Linear search:- Linear search is a search algorithm that finds an element in the list by…
Q: Divide-and-Conquer
A: Dear Student, The answer to your question is given below -
Q: answer fast What is a function? Something a
A: Dear Student, The answer to your question is given below
Q: In this assignment you will use the MyString class that you wrote earlier in this course. A…
A: The correct answer for the above mentioned question is given in the following steps for your…
Q: Why are these three protocols especially vulnerable to assault, given the importance of the network…
A: Protocols: Resolution Procedure Resolution Procedure Resolution Rot An Internet Service Provider…
Q: #include #include #include using namespace std; int main() { string userItem;…
A: Answer: #include <iostream>#include <sstream>//#include using namespace std; int main()…
Q: How are information systems put to use in the business world?
A: The study of structures as a basis for construction.Discovering the fundamental reason for a problem…
Q: Exercise :: Write the code for a V.B project that shown bellow; Form1 input 1 input 2 Sa sin ****…
A: Here is the code for the given image.
Q: In Python 3, a floating point number x is represented as What is the value of o? x = (−1)³ × m ×…
A: The Sigma level is a statistical calculation that takes short-term defect information per million…
Q: This article focuses on file extensions and the programs that generate them. Providing examples is…
A: Computers use file extensions to identify file types. After the filename and period is the file…
Q: Question 4. In a jar, there are n nuts and n matching bolts. All the bolts (and of course all the…
A: Here is the explanation regarding the problem using quicksort:
Q: Request iteration in DNS, the difference between authoritative and root servers, and the format of…
A: Introduction: Iterated and non-iterated requests, authoritative and root servers, and DNS records…
Q: function
A: Solution - In the given question, we have to Write a function that returns the greatest common…
Q: The given program reads a list of single-word first names and ages (ending with -1), and outputs…
A: Here is the the program regarding the incremented age.
Q: Fam Actor PF ador d SMALLINT mjd SMALLINT ador d first name name nationality Actor SMALLINT VARCHAR2…
A: I have written query below:
Q: Determine the first occurrence of "2" in "CO2 H20" MUST BE IN PYTHON
A: In Python, we will use string.find( ) method to search for the occurrence. If more than 1…
Q: Provide a brief rationale as to why you think this issue is important and critical to contemporary…
A: Answer:
Q: Digital Sum The digital sum of a number n is the sum of its digits. Write a recursive function…
A: Since the programming language is not mentioned, I have done the code using JavaScript.
Q: How does Virtualization help facilitate the development of Open-Source Software ?.
A: Introduction: Open-source software development is the process through which an open-source software…
Q: This piece will define file extensions and identify the programs that generate them. Some concrete…
A: File extensions are the three or four letters at the end of a file name which indicate the format of…
Q: Thank you but I think some methods u use I haven't learned yet, this is my program(image 1). Base on…
A: The Python program for the given problem is as follows: # printHistogram() function to print the…
Q: There are several ways in which system models diverge from conventional models. There are a lot of…
A: The system model is defined as follows and is used for numerous topics and domains: The systems…
Q: ectory on a UNIX system, only if the file name (not including the extension) begins and ends with a…
A: Dear Student, The answer to your question is given below -
Q: ending from 2 days solve asap.
A: According to the information given:- We have to follow the instructions in order to get the desired…
Q: Select the two answers that are correct examples for placing comments java source code.
A: Comments in java: If we write anything after comments(//) it will not be executed. It is also used…
Q: need help creating a GUI Java application using at least 3 GUI objects. Example of 3 objects would…
A: Created a GUI Java application that has 3 objects. They are: 1. A pane 2. A button 3. A text field…
Q: In what ways did you hope your preliminary Internet investigation might help to improve the…
A: The method in which new ideas are conceived and information is produced has been profoundly impacted…
Q: write a program that takes a string input from the user and calculates the sum of ASCII values of…
A: Step-1: StartStep-2: Declare variables sum_of_even_positions=0, sum_of_vowels=0Step-3: Declare…
Q: (a, 20), (c, 8), (d, 9) (b, 8), (d, 6), (e, 15), (h, 1 (b, 9), (c, 6), (e, 7) (c, 15), (d, 7), (f,…
A: Solution - In the given question, we have to construct the graph from the given adjacency list.
Q: Create a script to connect to a remote server and check if the service nginx or apache2 is currently…
A: Here is the explanation regarding a script to connect to the remote server:
Q: Why did people begin doing studies on the Internet in the first place? Finally, how were these…
A: The Internet has evolved in several ways using a variety of resources. Its extensive and complex…
Q: In what ways does the Internet facilitate the development of a worldwide data infrastructure? Do you…
A: The question is posed: what part does the internet play in developing a global information system?…
Q: Assume the following: A is a structure variable with members and are integers, and Members • member…
A: Correct answer is option D) pC-> mv->m1 sample code :- #include <stdio.h>#include…
Q: In this piece, we'll go over what file extensions are and which programs use them. Providing…
A: The solution is provided in the next section; Definition of File Extensions Computers read the…
Q: make Algorithm for Outline of collection Input: a pc presentation with generators {a 1, a2 ..... an…
A: algorithm given in next step:
Q: Choosing the right NAT mechanism is crucial for university network administrators. Stick to the…
A: The first answer to the aforementioned question may be found farther down the page. Port address…
Q: Write a function that takes as inputs the 3 sides of a triangle and returns true if it is a right…
A: algorithm:- bool checkTriangle(int p,int b,int h) if h*h==p*p+b*b return true else…
Q: Do security solutions for cloud computing vary from those for on-premise data centers?
A: What are the key differences between the security solutions provided for on-premises data centers…
Q: In order to demonstrate your competence, you should define the various types of social networking…
A: We are able to quickly disseminate information, exchange images and audio recordings, organize…
Q: Question 1. The input is an array a[1],..., a[n] of size n containing natural numbers between 1 and…
A: Algorithm to determine if the array contains 2 consecutive integers: input: array a[1],..,a[n] :…
Q: CHALLENGE ACTIVITY Assign a pointer to any instance of searchChar in personName to search Result.…
A: Coded using C++.
Q: position is a specific type of Inheritance.
A: Given :
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- The "enor function"), is a special function that often occurs in the fields of probability and statistics, looks 10 55 3 ** -0.3 -10 art The definition of erfix) can be found here, but for now that is unimportant. There is a function in the Python matherary that directly evaluates the error function for any single, real-valued number. You can import it with the Ine from math inport erf Suppose we want to find the root of the function fo))+J The Newton-Raphson Method does not behave well with functions of this sort (see the lecture notes), so we will need to use the section Method You are to unite a function relatina, eta, left, right, taterace which computes and returns that root aahe (n) and bets (3) are the constants defining the function for) above,left and right define a range known to contain the root, and tolerance is the maxim error that can be tolerated for the root, defined as in the previous questions Notes: You should use your bisection retider function from the previous…Implement a function rollsToRepeat in Python that simulates a dice game in which a pair of dice are rolled repeatedly until some total on the dice occurs the specified number of times. Details: accepts one integer argument, n , the number of repeats required before the game ends rolls a pair of dice repeatedly until some dice total has repeated n times returns the total number of times the pair of dice was rolled For example, using a random seed of 85 , the sequence of rolled pairs will be : (2, 6), (5, 1),(3, 2), (2, 4), (3, 5), (2, 6), (4, 5), (5, 2), (6, 5), (5, 5), ... If you runrollsToRepeat with n=1 , only 1 repeat is required. On the first roll, the total 8=2+6 is repeated once (as wouldany first roll). So the simulation stops and the function returns 1. This always happens whenn=1 . n=2 , some total must repeat twice. This first occurs on the 4throll, when the total of 6occurs for the 2ndtime. n=3 , some total must repeat three times. This first occurs on the 6throll, when…public static int Ack(int m, int n) { if (m == 0) { return n + 1; } else if (n == 0) { return Ack (m } else { } } return Ack (m - - 1, 1); 1, Ack (m, n- What is the return value of this function for a. Ack(0,0) b. Ack(0,3) c. Ack(0,6) Can you use the above three samples and come up with a formula for Ack(0,n)? 1));
- Write in Java: Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: 6 the output is: 110 Your program must define and call the following two methods. The method integerToReverseBinary() should return a string of 1's and 0's representing the integer in binary (in reverse). The method reverseString() should return a string representing the input string in reverse. public static String integerToReverseBinary(int integerValue)public static String reverseString(String inputString) LabProgram.java: import java.util.Scanner; public class LabProgram {/* Define your method here */ public static void main(String[] args) {/* Type your code…Write a function def reduced (n): n is a positive int number, greater than 0. The digit 0 does not appear in n. The function returns a positive int number such that includes all digits of n, but only NOT MORE THAN the first 2 most left ones for each digit. examples : reduced(474234524274377)== 474235273 reduced(6666666)=66 reduced(55555777779999966666)==55779966 reduced(5796)==5796 Requirements : Must NOT use strings. Must NOT use recursion. The function should be efficient in Time and Space.IN python, • generate_number(pct_per_digit): Takes one float as input. Returns a random number that is constructed as follows. First, use the function above to get a random number. This number will correspond to the length (number of digits) that the number generated by this function should have. For example, if that function returns 3, then this function should generate and return a random number with three digits. Note that in the case of a multi-digit number (2 digits or greater), the first digit cannot be 0. >>> random.seed(1337) >>> generate_number(0) 9 >>> random.seed(9002) >>> generate_number(0.5) 41700
- i want code in python Rahul is a maths genius so he came up with a game and as raj is Rahul's best friend so Rahul decided to play the game with raj. Rahul gives raj two numbers LL and RR and asks raj to find the count of numbers in the range from LL to RR (LL and RR inclusive) which are a digit palindromic. A number is a digit palindromic if its first digit is the same as its last digit. As raj is not very good at maths so your task is to help Raj find out how many numbers are a digit palindromic in the range LL to RR. For example if LL = 88 and RR = 2525 .The following numbers are a digit palindromic in the range of LL to RR: 8, 9, 11, and 22. If LL = 12511251 and RR = 12661266. The digit palindromic numbers are 1251 and 1261. Input format The first line contains an integer denoting the number of test cases. Each test case is described by a single line that contains two integers LL and RR. Output format For each test case output, an integer denoting how many a digit palindromic…This is for Java Write a recursive function that takes as a parameter a nonnegative integerand generates the following pattern of stars. If the nonnegative integer is 4,then the pattern generated is:**********Also, write a program that prompts the user to enter the number of lines inthe pattern and uses the recursive function to generate the pattern. Forexample, specifying 4 as the number of lines generates the above pattern. Java pleaseIn python, Problem Description:Sheldon and Leonard are physicists who are fixated on the BIG BANG theory. In order to exchange secret insights they have devised a code that encodes UPPERCASE words by shifting their letters forward. Shifting a letter by S positions means to go forward S letters in the alphabet. For example, shifting B by S = 3 positions gives E. However, sometimes this makes us go past Z, the last letter of the alphabet. Whenever this happens we wrap around, treating A as the letter that follows Z. For example, shifting Z by S = 2 positions gives B. Sheldon and Leonard’s code depends on a parameter K and also varies depending on the position of each letter in the word. For the letter at position P, they use the shift value of S = 3P + K. For example, here is how ZOOM is encoded when K = 3. The first letter Z has a shift valueof S = 3 × 1 + 3 = 6; it wraps around and becomes the letter F. The second letter, O, hasS = 3 × 2 + 3 = 9 and becomes X. The last two letters…
- Write a program in C++ to find the area of any triangle using Heron'sFormula: Side = (a+b+c)/2Area= sqrt (Side *(side-a) *(Side-b)*(Side-c)Note: use #include <math.h> to run/recognize the sqrt Sample Input:Input the length of 1st side of the triangle : 5Input the length of 2nd side of the triangle : 5Input the length of 3rd side of the triangle : 5Sample Output:The area of the triangle is : 10.8253java: Run length coding is a method to represent a string in a more compact manner. Each character that occurs more than 2 times in a row is represented by the character and a number following it. Two examples are: "abba" → "abba""abcccbbbba" → "abc3b4a"Write a function that calculates how many characters the encoded string is shorter than the original.Need help in python. Problem: 2D random walk. A two dimensional random walk simulates the behavior of a particle moving in a grid of points. At each step, the random walker moves north, south, east, or west with probability 1/4, independently of previous moves. Compose a program that takes a command-line argument n and estimates how long it will take a random walker to hit the boundary of a 2n+1-by-2n+1 square centered at the starting point. //Given codeImport stdioImport randomImport sysn = int(sys.argv[1])//write code herestdio.write('The walker took ')stdio.write(c)stdio.writeln(' steps')