python exercise: Write a Python function called calculate_average that takes a list of numbers as input and returns the average of the numbers in the list. If the input list is empty, the function should raise an EmptyListError exception. Handle the case where the input list is empty by raising a custom EmptyListError exception. This exception should have an error message that says "Cannot calculate average of an empty list".
Q: What method does SETI use to connect individual computers into a potent system?
A: SETI uses distributed computing to connect individual computers into a potent system.
Q: When individuals refer to an operating system, what exactly do they mean by that? The following are…
A: When individuals refer to an operating system, what exactly do they mean by that? The following are…
Q: The next sections will provide you with the definitions of the classes MonthCalender and…
A: Overture to Month Calendar plus DateTimePicker: MonthCalendar and DateTimePicker are two of the…
Q: Many different things can contribute to the onset of a downgrade attack.
A: A downgrade attack is a type of cyber attack where an attacker manipulates the communication between…
Q: Have you previously utilised top-down design principles? Please explain why if so. Include at least…
A: A top-down design is when a system is broken down into smaller pieces to better understand its…
Q: What are three options that could be utilised in a project based on the structure of the decision…
A: In step 2, I have provided Answer-------------
Q: Exp
A: The architecture of an application plays a critical role in determining its performance,…
Q: Q2. List the typical tasks during the software maintenance phase with an example. List the different…
A: Here is your solution :
Q: Give a high-level summary of the nonvolatile solid-state memory technologies that are gaining…
A: Technologies used in nonvolatile solid-state memory allow computers to preserve data even after the…
Q: Describe how the protection and instruction of set architecture is carried out.
A: 1) Set architecture, or instruction set architecture (ISA), refers to the set of instructions that a…
Q: What components are necessary to construct a web-based application?
A: A web-based application, also known as a web application, is a software program that can be accessed…
Q: What do we think of when we hear the phrase "operating system," and more specifically who or what do…
A: The operating system is basically the heart of the system, which operates the hardware and the…
Q: There are several advantages to using dynamic memory rather than static memory, but there are also…
A: Flexibility: Dynamic memory allocation allows for reminiscence to be owed and deallocated…
Q: What does "avalanche effect" mean exactly? Modern block cyphers do not support avalanche cyphers.…
A: The avalanche effect is a desirable property of cryptographic algorithms, especially block ciphers.…
Q: Does implementing technology advancements in education, business, and society outweigh the potential…
A: Working with computers and other technologies is easier if you understand them. in the following…
Q: If you want to join the computer to an existing domain after installing Windows 7, which network…
A: Selecting Network Location for Windows 7 Domain Join: When you want to join a computer to an…
Q: Write in C: Quesiton 2. Implementing non-blocking / non-echoing mode for xv6 console The default…
A: To implement non-blocking and non-echoing mode for the xv6 console, we can modify the console driver…
Q: Describe the development of the internet as well as the technologies that lie underneath its…
A: The swelling of the Internet can be traced rear to the late 1960s, with its beginning in a US…
Q: Teaching is a multi-dimensional profession that encompasses a wide range of subject matter areas.
A: Given that, Teaching is a multi-dimensional profession that encompasses a wide range of subject…
Q: In addition to giving a definition of the term, can you provide some specific instances of how…
A: What is vulnerability: Vulnerability refers to weaknesses or gaps in a system's security that could…
Q: Windows recognises four fundamental disc volume categories. Using only your own words (no copying is…
A: Windows operating system recognises four fundamental disc volume categories, each with unique…
Q: Please provide a brief description of the nonvolatile solid-state memory techniques that are…
A: In this question we need to explain the nonvolatile solid-state memory techniques which are becoming…
Q: Route first. Differentiate two prominent routing strategies.
A: Given, Differentiate two prominent routing strategies.
Q: What is the appropriate number for the server port? Choose the correct answer a any number between 0…
A: Below is the complete solution with explanation in detail for the given question about the…
Q: The following SQL for a Point of Sale database for a grocery store is not properly constructed. As…
A: The SQL are modifed and given below with explanation
Q: Should we make use of an asynchronous bus or a synchronous bus in order to link the CPU and the…
A: What is CPU: The CPU (Central Processing Unit) is the brain of a computer system and is responsible…
Q: Chain Link Consulting is an IT consulting firm that specializes in system security issues. The…
A: Chain link consulting is an IT consulting firm specializing in system security issues. As experts in…
Q: Some IT security specialists believe that former computer criminals should be employed to identify…
A: Security vulnerabilities: Security vulnerabilities refer to weaknesses or flaws in a system's…
Q: 1. Use the starter code to create your PromptBank and modify it to work with your project. (Note:…
A: See the code below in java
Q: Do you understand why it's essential to use authentication? What are the benefits and downsides of…
A: Authentication is making sure a person or process is who they say they are by using IDs like…
Q: Introduce real-time operating systems before going into specific examples. Compare it to a typical…
A: An operating system created to specifically address the needs of real-time applications is known as…
Q: What do you consider to be the four most significant characteristics in a software engineer? Which…
A: Below are characteristics that are generally considered important for software engineers: 1) Strong…
Q: Analyse the differences between the Von Neumann architecture and the Little Man computer. Which…
A: The Von Neumann architecture is a computer architecture model that was first proposed by John von…
Q: Is it a good idea to have software service providers take care of all of your technology needs?…
A: Cost-effectiveness: By eliminate the need for business to invest in the communications, technology,…
Q: Explain the distinction between logical address and linear address, as well as the relationship…
A: Logical Address: A logical address, also known as a virtual address, is a memory address generated…
Q: Why is it important to do a vulnerability analysis?
A: Vulnerability analysis is a crucial aspect of maintaining the security and integrity of any system,…
Q: Computer studies How can disruptive technologies allow organisations to make major changes?
A: Disruptive technologies can allow organizations to make major changes by introducing new and…
Q: If you were to hire a software engineer, what would you consider to be the four most significant…
A: Hiring the right software engineer is critical to the success of any software development project.…
Q: When evaluating different internet service providers, what are the three most important factors to…
A: Speed and Reliability: The speed and dependability of the internet connection provided by an ISP is…
Q: Write a function to sort an array of integers using the merge sort algorithm. What is the time…
A: def merge_sort(arr): if len(arr) > 1: mid = len(arr) // 2 left_half = arr[:mid]…
Q: How does one input user information into a database?
A: In computer science, databases are commonly used to store and manage large volumes of data…
Q: Each account should have a constant, unique id. Id numbers should start from 1000 and increment by…
A: The requirement states that each account should have a unique ID that starts from 1000 and…
Q: your view, which procedures for the administration of a firewall are the most efficient? Explain.
A: Your answer is given below.
Q: How many socket is/are created in the server and client side? a 1 b 2 c 3 d 4
A: The correct answer is given below
Q: Numerous factors play a role in determining whether or not a network is able to communicate…
A: Because each network is unique in its nature and architecture, there are many different techniques…
Q: Take into consideration the downsides of a weighted graph representation that utilises an adjacency…
A: A weighted graph is a type of graph representation where each edge has a weight or cost associated…
Q: Make a ‘contact us form’ concept and layout for a login website using c#
A: A contact us form is a web-based form that allows users to submit inquiries or messages to the…
Q: There are two different purposes served by the logs of a database. What exactly do you mean by…
A: A database log serves two purposes: to provide a record of database transactions for recovery and to…
Q: What are the best practises for firewall administration?
A: A firewall is a network security system that monitors and controls incoming and outgoing network…
Q: Are there a variety of methods that may be used to process things? Which ones are aligned in a line,…
A: Yes, there are a variety of methods that may be used to process things.
python exercise:
Write a Python function called calculate_average that takes a list of numbers as input and returns the average of the numbers in the list. If the input list is empty, the function should raise an EmptyListError exception.
Handle the case where the input list is empty by raising a custom EmptyListError exception. This exception should have an error message that says "Cannot calculate average of an empty list".
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- This will happen if you try to use an index that is out of range for a list.a. A ValueError exception will occur.b. An IndexError exception will occur.c. The list will be erased and the program will continue to run.d. Nothing—the invalid index will be ignored.2. Searches for any number within the sorted list using Binary search. Searches for any number that is not exist in the sorted list. Use exception handling to print out the corresponding error messagePython please: Write a program that reads the integers user_index_num and user_element_value as input, and update the list index element with user_element_value. Then output the list. Note: The list given is list = [1,2,3,4]. Use a try block to perform all the statements. Use an except block to catch any IndexError and output an exception message. Use another except block to catch any ValueError caused by invalid input and to output an exception message. Note: Please use list = [1,2,3,4]. IndexError is thrown when an index that is not bound in the list happens. Output wording should match examples below ValueError is thrown when a user enters a value of a different data type than what is defined in the program. Output wording should match example below. Example: If the input of the program is 2 5 the output of the program is [1, 2, 5, 4] Example: If the input of the program is 15 3 the output of the program is Index 15 Error list assignment index out of range Example: If the input of…
- Filename: runlength_decoder.py Starter code for data: hw4data.py Download hw4data.py Download hw4data.pyYou must provide a function named decode() that takes a list of RLE-encoded values as its single parameter, and returns a list containing the decoded values with the “runs” expanded. If we were to use Python annotations, the function signature would look similar to this:def decode(data : list) -> list: Run-length encoding (RLE) is a simple, “lossless” compression scheme in which “runs” of data. The same value in consecutive data elements are stored as a single occurrence of the data value, and a count of occurrences for the run. For example, using Python lists, the initial list: [‘P’,‘P’,‘P’,‘P’,‘P’,‘Y’,‘Y’,‘Y’,‘P’,‘G’,‘G’] would be encoded as: ['P', 5, 'Y', 3, ‘P’, 1, ‘G’, 2] So, instead of using 11 “units” of space (if we consider the space for a character/int 1 unit), we only use 8 “units”. In this small example, we don’t achieve much of a savings (and indeed the…program - python Question: Create a class called Candy which keeps track of the three pieces of information Read in the file line by line and create a Candy class instance for each candy bar you have, and add that new instance to a list. Once you have the list created, loop through the list and print the candy bar info out to the consoleUse this as an example: class Coord: def __init__(self, x, y): self.x = x self.y = y def main(): # creating list list = [] with open('C:\\Users\\owner\\Documents\\mycoords.txt') as f: for line in f: # print(line.strip()) words = line.split(',') x=float(words[0]) y=float(words[1]) list.append(Coord(x,y)) f.close() # Accessing object value using a for loop for p in list: print(f"Coordinate: x={p.x}, y={p.y}") print("") main()Given a list named my_list. my_list=[10,20,30,40,60,100,2,5] Write a python program that takes the position as an input from the user and prints the element of that position from the list. If the user’s input position is not in the range, return an exception stating “Index out of range”. Make sure your program always prints “Program ended” at the end, no matter what happens. ============================= Hint: Use finally block ============================= Example 1:Input:1Output:20Program ended ============================= Example 2:Input:10Output:Index out of range.Program ended what is the solution of this in python programming?
- Write a python program that takes two lists as input from the user, multiplies the index-wise elements of the two lists, and adds it to a new variable. While doing the program you should handle the following exceptions: Return an exception if an element in a list is not a number stating “The list has some non-number values”. Return an exception if there is an index out of bound stating “Index out of bound”. ============================= Example 1:Input:list_one = [1, a, 2, 4]list_two =[5, 6, 7, 8]Output:The list has some non number values ================= Example 2:Input:list_one=[1, 2, 3, 4, 5]list_two=[1, 2, 3, 4]Output:Index out of bound ================= Example 3:Input:list_one=[1,2,3,4]list_two=[5,6,7,8]Output:701) - Write a Python function that will receive a list as an argument. A) The function will receive a list of at least 5 numbers as a single argument when the function is called. B)The function will ask the user to input a number and will find and return the index of that number in the list. C). If the number is not an element of the list, the function returns the string "unknown" and asks the user to try again. There can be a total of 3 possible failed trials, after which the program will return a message to the user and exit. Choose your own exit message.Q1:Write a function that returns a new list by eliminating theduplicate values in the list. Use the following function header:def eliminateDuplicates(lst):Write a test program that reads in a list of integers, invokes the function,and displays the result. Here is the sample run of the program Enter ten numbers: 2 3 2 1 6 3 4 5 2The distinct numbers are: 1 2 3 6 4 5 Q2:Write a program that reads in your Q1 Pythonsource code file and counts the occurrence of each keyword in the file.Your program should prompt the user to enter the Python source code filename. This is the Q1: code: def eliminateDuplictes(lst):newlist = [] search = set() for i in lst: if i not in search: newlist.append(i) search.add(i) return newlist a=[] n= int(input("Enter the Size of the list:")) for x in range(n):item=input("\nEnter element " + str(x+1) + ":") a.append(item) result = eliminateDuplictes(a) print('\nThe distinct numbers are: ',"%s" % (' '.join(result)))
- For this project you will create a program that populates a list of 8 car manufacturers. You can have theuser populate the list or you can have it predefined.(your choice)If you used a predefined list, then ask the user to add a car manufacturer to the list,Example:cars = ['Ford', 'BMW', 'Volvo']print(‘Enter a new Car Manufacturer: ’)cars.append(input())Use the len() function to acquire the length of the list.(this number is used at the end)Example:cars = ['Ford', 'BMW', 'Volvo']length = cars.len()Use the sort() function to sort the list, (Sort before it is displayed at the end)Example:cars = ['Ford', 'BMW', 'Volvo']cars.sort()and displays the contents of the list using a for loop in the following format:The 9 car manufacturers are:BMWFordVolvoThe given program reads a list of single-word first names and ages (ending with -1), and outputs that list with the age incremented. The program fails and throws an exception if the second input on a line is a string rather than an integer. At FIXME in the code, add try and except blocks to catch the ValueError exception and output 0 for the age. Ex: If the input is: Lee 18 Lua 21 Mary Beth 19 Stu 33 -1 then the output is: Lee 19 Lua 22 Mary 0 Stu 34 code name = ()age = ()parts = input().split()name = parts[0]while name != '-1':# FIXME: The following line will throw ValueError exception.# Insert try/except blocks to catch the exception.age = int(parts[1]) + 1print('{} {}'.format(name, age))# Get next lineparts = input().split()name = parts[0]A Lo Shu Magic Square is a grid with 3 rows and 3 columns. The Lo Shu Magic Square has these properties:-A grid that contains the numbers 1-9.-The sum of each row, each column, and each diagonal all adding up to the same number.In Python create a program simulatimg the magic square using a two-dimensional list.Additional requirements: -It must throw an exception if any character other than 1 – 9 is selected.-The program needs to give an message explaining that wrong input has been provided.-The program should prompt the user until the condition has been satisfied. It should prompt the user to enter a number from 1-9.-The program can only use each number once.-When the program starts, it should explain how to play the game. Those who have never heard of it should be able to play. The directions should be clear.-Show an example of a Lo Shu Magic Square after each game.-The program should allow users to play the game until they choose to quit.It also must keep track of wins and…