In a python program you can simulate a magic square using a two-dimensional list. Write a function that accepts a two-dimensional list as an argument and determines whether the list is a Lo Shu Magic Square. Test the function in a program.
Q: Write a Python function called name_processor that takes a list of students' full names and returns…
A: According to the Question below the Solution: Output:
Q: Write a function somme_even that takes a list as an argument and returns the sum of the even numbers…
A: Please find the answer below :
Q: Please answer it in Python Write a function min_odd that takes a list as an argument and returns…
A: The python codes are given below
Q: Write a python function that takes a list as an argument. Your task is to create a new list where…
A: def remove(lst): lst_1=[] for i in lst: if lst_1.count(i)==2: pass…
Q: Write a function that accepts a variable number of string parameters. The function must use list…
A: Answer in step2
Q: Write a python function that takes a list as an argument. Your task is to create a new list where…
A: Read the size of the list and the list element using map() which takes list input from the user.…
Q: Write a function called find_max that takes a two-dimensional list as a parameter and returns the…
A: program code : // C# program to find row with// max sum in a matrixusing System;using…
Q: 2. Write a python program as function that displays a list Prog and returns a tuple of two list…
A: def fun(Prog): # user define function print("The list:", Prog) # display the…
Q: for my python class, I need to write a program that has a list that stores repeated heart-rate…
A: Average of heart rate in python . The heart rates are stored in a list
Q: Write a python function that takes a list of numbers(integer) and a number(integer) as arguments.…
A: First, we will pass the the list and the second arguement. Inside the function we will find the…
Q: Write a function that does the following: 1. Its name is flatten. 2. It will take one parameter,…
A: ALGORIHTM / STEPS: Create a new list for storing the elments of numbers list Traverse through…
Q: In PYTHON Given a list of ints, a start index, and an end index (not inclusive), function should…
A: Below is the code in python and sample output:
Q: Write a python function that takes a list as an argument. Your task is to create a new list where…
A: A list is a data item that stores many values using a single variable name. To define a list all…
Q: in picat) 10. split list(Lst,N): split Ist into two parts with the first part having N elements,…
A: Note: As per the guidelines for the multiple questions, we can answer only the first question,…
Q: In Python Use the Design Recipe to write a function bools_2_str, which consumes a list of booleans…
A: Create a Boolean list with true and false value such as:boolList = [True, True, False, True, False,…
Q: Write a Python function that will ask the user for an integer X bigger than 20 and return a list…
A: GIVEN: Write a Python function that will ask the user for an integer X bigger than 20 and return a…
Q: Write a function randomList() that gets three integers as parameters, start, bound, and k. This…
A: In Python, to generate a list of random numbers with specified ranges and sizes, random.sample()…
Q: Develop a program that gets a list of student grades and find: grade average, max grade, and min…
A: Input : Input grades of students Output : Average grade Maximum grade Minimum grade
Q: Write a function gravity that evaluates y(t) = v0t - (1/2) gt2 at n uniformly spaced times between…
A: A function is a code which possibly runs when it is called. You can pass information, known as…
Q: Write a function that takes a list as a parameter. The list will contain a mixture of integers and…
A: Rawcode: #asking user to enter list elements elements = input("Enter the list elements: ")…
Q: Given the non-negative integers m and n (with m<n), create a list of triangular numbers between (and…
A: Solution :
Q: Write a function that takes two arguments, a list L1 and a list L2. • If the length of the list L1…
A: l=list(map(int,input().split()))m=list(map(int,input().split())) li=[]if len(l)>2*len(m):…
Q: ) Write a function dropLowest() with one parameter n. 2) n is a list that contains any 5 random…
A: def dropLowest(n): index_Of_min = n.index(min(n)) n.remove(n[index_Of_min]) return…
Q: Write a program that takes sequence of comma separated numbers an input from the user. The program…
A: Code: #reading list of numbers with comma separatorL = [int(x) for x in input("Enter numbers with…
Q: Write a Python function peaksIndex() that takes a list as parameter, returns a list that contains…
A: def peaksIndex(arr): peaks=[] #for storing indexes of peak values for i in…
Q: Write a python function MedianWithoutHL(ScoreList) that takes an unsorted list of n numbers as a…
A: In the solution of program, we use remove(), sort() and len() function of list. The remove function,…
Q: 3. Define a function in Python that takes a list as the parameter and returns True if the list…
A: Define a function in Python that takes a list as the parameter and returns True if the list contains…
Q: Write a program in Python including the following functions: Write a function that takes a list and…
A: #to add in list recursivelydef addToLst(lst, value, times, index): #check if times need to add is…
Q: unction will return a list of numbers whose elements are Ax^2, where x is an element of the inputed…
A: According to the Question below the Solution: Output:
Q: create a Python function, called number(Lollntegers), which takes as parameter a list made up of…
A: Program: def number(LollIntegers): # called function recieve the list of integers from calling…
Q: Write a program that takes a list of S integers and performs the following functions. Create two…
A: 1) Below is program that takes a list of S integers and performs delete prime and reverse list…
Q: Write a function is Prime (a_nNum) that takes a positive integer as an argument and returns True if…
A: Here is the python code. See below step for code and output:
Q: Write a Python program that takes 7 random scores as inputs and appends them to a list (aGrades).…
A: Given: Calculate the number of exams as the length of the list minus one; assign examCount to…
Q: ???????: Write a Python program that takes a list and a step size(integer number) as inputs from the…
A: Algorithm: Start Read a list of elements Read step size n If n>len(list)/2, print swapping is…
Q: Write a python function that takes a list as an argument. Your task is to create a new list where…
A: the given python code is takes list as argument and prints the number of elements removed from the…
Q: Write a Python function called name_processor that takes a list of students' full names and returns…
A: Here I have created a function named name_processor(). In this function, I have iterated over the…
Q: please code in python Write a function that takes in a number and returns the sum of all primes…
A: def isPrime(n): if n <= 1 : return False for i in range(2, n): if n % i == 0: return False…
Q: Write a function called 'filler (A, 1) that takes an integer A, and a list of integers '1 and if…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
Q: Write a python code 3) Write a script that asks user to enter 10 integer numbers, creates a list…
A: Your python program is given below as you required with an output.
Q: Write a function that will accept a list of integers and return the sum of the contents of the…
A:
Q: Please write it in Python Write a delete function that takes as an argument a list l and an elem…
A: Python Code: def delete( l, x ): l.remove(x) return x Explaination : Define a function…
Q: Write a function that accepts a number and a string as arguments. It should return a list having n…
A: We need to write a function that accepts two parameters- a number a string The function will…
Q: Create a function that takes a list of numbers and returns a list where each number is the sum of…
A: Sample Response: #python3 program#function to takes a list of numbers and returns a list where each…
Q: Use the Design Recipe to write a function, count_odds, that consumes a list and two integers,…
A: Please find the answer below :
Q: Our second pattern is the mapped list pattern, described in video 4 3 mapped list pattern. Often we…
A: The for loop in Python is used to iterate the statements or a part of the program several times. The…
Q: Write a Python program that generates a list with 10 random integer numbers between 1 and 100. In…
A: Below is the required code in Python language. Approach of a Program: Use list comprehension +…
Q: Complete the calc_average() function that has an integer list parameter and returns the average…
A: The Python program along with the snapshot of code and output is given below:
Q: Write a program that reads a list of integers, and outputs whether the list contains all multiples…
A: Answer
Q: Write a program in Python including the following function: Write a function which takes a list of…
A: #recursive method to form a number def formNum(lst, n, num): #finding list length l =…
Q: known that a matrix can be understood (in python) by a list of lists. In this context, make a…
A: Please find the answer below
In a python program you can simulate a magic square using a two-dimensional list. Write a function that accepts a two-dimensional list as an argument and determines whether the list is a Lo Shu Magic Square. Test the function in a program.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 5 images
- The text presented the Sierpinski triangle fractal. Inthis exercise, you will write a program to display another fractal, called the Kochsnowflake, named after a famous Swedish mathematician. A Koch snowflake iscreated as follows:1. Begin with an equilateral triangle, which is considered to be the Koch fractalof order (or level) 0, as shown in Figure a.2. Divide each line in the shape into three equal line segments and draw an outwardequilateral triangle with the middle line segment as the base to create aKoch fractal of order 1, as shown in Figure b.3. Repeat Step 2 to create a Koch fractal of order 2, 3, . . . , and so on, as shownin Figures c and d.The theater seating map is represented by a table with ticket prices for each seat, like this one.10, 10, 10, 10, 10, 10, 10, 10, 10, 10 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 10, 10, 20, 20, 20, 20, 20, 20, 10, 10 20, 20, 30, 30, 40, 40, 30, 30, 20, 20 20, 30, 30, 40, 50, 50, 40, 30, 30, 20 30, 40, 50, 50, 50, 50, 50, 50, 40, 30 Write a program that asks the user to choose either a place (providing row and column) or a price orto exit from the program. When the user specifies a place, make sure that it is free and that the coordinates are inside the table. When specifying a price, you can assign any seat that’s available at that price (if any). Mark seats already sold with a price equal to 0.Imagine that you own a flower store and you need to display a menu of all the item categories, items and prices you sell for your customers. Display the prices for each product and category. The flowers are {"Rose", "Carnation", "Tulips", "Sunflowers"}, the price in order are {1.15, 1.5, 2.5, 2.75} the second category is vase sizes, {"Small", "Medium", "Large", "XLarge"}, the prices in order are {1.25, 2.5, 3.75, 4.5}. The last category is add ons, {"Teddy Bear" , "note", "ballon", "choclates"}. The prices are in order {10.0, 2.5, 5.75, 8.75} The list of products and the list of prices should be stores in 2 separate arrays. Create a method "display" that accepts 2 arrays as parameters and displays the product and the prices in receipt form. Create another method "sum" that displays the total for each category.
- Create a Triangle class that extends the SimpleGeometricObject class in Eclipse, followingthe below UML diagram. Use the following formula to calculate the area of a triangle:A = 1/2 × base × height the SimpleGeometricObject code is below in link and picture https://liveexample.pearsoncmg.com/html/SimpleGeometricObject.html the ending part of the code and didnt appear in the picture } /** Return a string representation of this object */ public String toString() { return "created on " + dateCreated + "\ncolor: " + color + " and filled: " + filled; } }In a game of tic-tac-toe, two players take turnsmarking an available cell in a 3 x 3 grid with their respective tokens (either Xor O). When one player has placed three tokens in a horizontal, vertical, or diagonalrow on the grid, the game is over and that player has won. A draw (no winner)occurs when all the cells on the grid have been filled with tokens and neitherplayer has achieved a win. Create a program for playing a tic-tac-toe game.The program prompts two players to alternately enter an X token and O token.Whenever a token is entered, the program redisplays the board on the console anddetermines the status of the game (win, draw, or continue). Here is a sample run:You have a backpack that can carry at most 15 kg of stuff (following image). There are ten boxes of five types (A, B, C, D, and E), with two boxes of each type. The weights and values of the boxes are given in the figure. You want to select some of these boxes to put in your backpack in order to maximize their total value, but you cannot exceed the backpack’s weight capacity. Additionally,• if a type B box is selected, then no type C box can be selected• at least one box of either type A or type D must be selected Formulate an integer linear programming model to help you make the bag packing decision. To assist you, below are your decision variables.• yi: select (= 1) or not select (= 0) type i box, i = A, B, C, D, E.• xj: The number of type j boxes selected, j = A, B, C, D, E.
- Create grid and play_board Step 1: Assign two variables grid_n should be assigned the integer 15 iter_n should be assigned the integer 25 Step 2: Call play_board Call play_board() with the following inputs for the parameters in play_board: bots | input should be bots_list grid_size | input should be grid_n n_iter | input sould be iter_n Upon executing the cell, you should see a a 15x15 grid, with three bots (of different shapes), wandering around the grid for 25 iterations.In this lab, you will use a timer to animate the movement of a heart image to the location where the mouse clicks, as shown below. In jacascript, please! The given web page shows a heart image. When the user clicks anywhere in the page, the startAnimation() function is called. startAnimation() determines where the user clicked and calls moveImage() with the clicked (x, y) coordinate. moveImage() moves the heart 1 pixel in the direction of the given (x, y) coordinates. Make the following JavaScript modifications using clearInterval() and setInterval() where appropriate: In startAnimation(), add an if statement that stops the timer with the ID timerId if timerId is not null. In startAnimation(), start a timer that calls moveImage(clickX, clickY) every 10 milliseconds. Save the timer ID in the timerId variable. Add an if statement in moveImage() that stops the timer with the ID timerId if (imgX, imgY) is equal to (centerX, centerY). Also set timerId to null. After the…please find the area of a triangle in 2 ways given the points A, B, and C. Plot the points A= (0,2,6), B= (8,2,2), and C= (5,6,4) in Geogebra and 1): Use the polygon command: Polygon(A,B,C) --this will give the lengths of the 3 segments of the triangle and then give the area of this triangle 2) Using Heron's Formula: A=s(s−a)(s−b)(s−c) where s=a+b+c2 and the sides of the triangle are a,b,c (these are given in the Polygon command in step 1).
- Can you please complete the following code in processing language : PImage img; // here we need to add 9 images such as 9 planets of the solar system and set the texture for 9 images on objects and display it on the screen PShape globe; void setup() { // Load an image img = loadImage("earth.jpg"); globe = createShape(SPHERE, 50); // Automatically texture the shape with the image globe.setTexture(img); }1. Let's go bowling! Ask your user if they want to play 5 or 10 pin bowling, then print out a '"*" for each pin! Make sure you have the correct bowling pin layout .Create a simple guessing game, similar to Hangman, in which the user guessesletters and then attempts to guess a partially hidden phrase. Display a phrase inwhich some of the letters are replaced by asterisks: for example, G* T*** (for GoTeam). Each time the user guesses a letter, either place the letter in the correctspot (or spots) in the phrase and display it again or tell the user the guessed letteris not in the phrase. Display a congratulatory message when the entire correctphrase has been deduced. Save the game as SecretPhrase.java. In the nextchapter, you will modify this program so that instead of presenting the user withthe same phrase every time the game is played, the program randomly selects thephrase from a list of phrases. Professor's note: "HINT on Lab #4 : Be sure to check for UPPER & LOWER Case entries from the User when they enter guessed characters for your phrase."