A sloppy Python programmer wrote the following code, which is supposed to find the longest line of text in the file 'test.txt' and print it to the screen (without the trailing newline character). As you will notice, the code contains syntax and/or logical errors. Select all lines that exhibit errors. longest size, longest_text = 0, with f = open("test.txt", "r"): for line in f: if len(line) < longest_size: longest size += 1 longest text = line.rstrip("\n") print (f" longest line: \"{longest_text}\"")
Q: You are going to simulate the operation of an AVL tree on paper. For the purposes of this…
A: In conclusion, the directions provided were followed in simulating the AVL tree processes. The…
Q: 2) Discuss the historical progression and impact of programming paradigms in computer science,…
A: The process of designing and writing code, or instructions, for a computer to follow is called…
Q: List the cooling techniques used in PCs.
A: A personal computer, sometimes known as a PC, is a type of general-purpose device intended for…
Q: No AI
A: Algorithm complexity analysis is significant because it allows us to understand how an algorithm…
Q: Show how to find all the factors of the following numbers in an efficient manner. Explain why you…
A: Efficiently locating all elements of a range of is important in numerous mathematical and…
Q: b.Start from the resource allocation state in Q 13. If a request from a process P3 arrives for (1,…
A: The objective of the question is to determine if the system can grant the requests from processes P3…
Q: Which is an example of an unstructured query? (A) SQL query over an XML database (B) XQuery query…
A: Let's break down each option:(A) SQL query over an XML database: SQL (Structured Query Language) is…
Q: Consider the following recursive function: public static int mystery (int n) { if…
A: The objective of the question is to understand the functionality of a given recursive function in…
Q: Question 1: Assume a computer that has 32-bit integers. Show how each of the following values would…
A: Memory Addressing: The memory addresses start from 0x100 and go sequentially. Each address…
Q: Which of the following lists are used to mean that a class has been derived from another class?…
A: The question is asking us to identify the terms that are commonly used to refer to a class that has…
Q: Write the corresponding Mic-2 MAL and Mic-3 instructions to implement the following IJVM assembly…
A: Here are the corresponding Mic-2 MAL and Mic-3 instructions for the given IJVM assembly…
Q: In Computer Graphics, can you emphasize on what types of data uniforms are? Explaining in a very…
A: More explanations:What Are Uniforms?Uniforms in computer graphics are special variables used in…
Q: There's something wrong with this code. - All images should by 100px by 100px index.html file:…
A: The objective of the question is to identify and correct the issue in the provided HTML and CSS…
Q: Memory Bandwidth Calculation A computer system has a bus width of 64 bits, a clock speed of 2 GHz,…
A: The objective of the question is to calculate the memory bandwidth of a computer system given the…
Q: Explain the concept of operator precedence and associativity in programming languages. How does…
A: The rules that dictate which operators are evaluated first in an expression are known as operator…
Q: Implement a RESTAURANT C++ program: that has multiple branches, and each branch has menus of food…
A: In this question we have to write a C++ code for the restaurant management system capable of…
Q: Utilize the following ordered sets of vectors, each which represents a basis for R³, for this…
A: Calculating the determinants gives us zero therefore the vector in set B are linearly dependent The…
Q: In C++, using on GLFW3 and glad.h, how do you implement a 3D Sphere in terms of implementation…
A: To implement a 3D sphere in C++ using GLFW3 and glad.h, you'll first need to create a vertex buffer…
Q: QUESTION 1 Who was the Intel Executive who said the performance of hardware will double every year…
A: The evolution and growth of the technology industry have been driven by visionary leaders,…
Q: In Matlab code 2. A fibonacci sequence is a sequence such that, beginning with the third element,…
A: Set the Fibonacci sequence's first two terms to their initial values: `a1 = 3` `a2 = 7`Create a…
Q: True or False and correct the tatse sentences 1. AT power supply has 20-pin motherboard connector 2.…
A: Older computer systems' AT power supplies have several important parts. Transformers reduce AC input…
Q: C Sharp How do I format my code to 2 decimal places whem I am calling my code in Main using…
A: Let's break down the solution into a step-by-step process, focusing on how it accomplishes the task…
Q: Fix any error in this code import org.jfree.chart.ChartFactory;import…
A: The objective of the question is to identify and correct any errors in the provided Java code. The…
Q: A byte-addressable system with 16-bit addresses ships with a three-way set associative,…
A: Here's how to find the block size:We know the total size of the tag store is 264 bits.We are also…
Q: could you fill in the blanks for me please I'm struggling
A: For the grammar:S→aSb∣A A→aA∣ε For the PDA transitions, you would fill in the blanks as:The initial…
Q: There are numerous phrases that are palindromes when spacing is ignored. Examples include “go dog”,…
A: In conclusion, the provided Python code extends the solution to Exercise 75 by implementing a…
Q: average internet speed in your house. What is the margin of error for this estimate?
A: To find the margin of error for the estimate of the average internet speed in your house, we'll use…
Q: Algorithm 5.7 The Backtracking Algorithm for the 0-1 Knapsack Problem Problem: Let n items be given,…
A: The 0-1 Knapsack problem aims to maximize the total profit by selecting items with given weights and…
Q: Memory Organization
A: **Count of Main Memory Blocks**: The following formula is used to get the number of blocks in main…
Q: In Matlab code 2. A fibonacci sequence is a sequence such that, beginning with the third element,…
A: Start by initializing the first two terms of the Fibonacci sequence, setting them as 3 and 7.Create…
Q: In Matlab code 2. A fibonacci sequence is a sequence such that, beginning with the third element,…
A: According to our company's policy, we are obliged to answer only the first question case of multiple…
Q: In virtually all systems that include DMA modules, DMA access to main memory is given higher…
A: The objective of the question is to understand why DMA (Direct Memory Access) is given higher…
Q: I need help with this Java problem to output as it's explained in this image below:
A: The objective of the question is to identify the correct dequeue algorithm for a Queue implemented…
Q: Discretized values in a decision tree may be combined into a single branch, if: Group of answer…
A: You can choose multiple answers here:order is not preserved: This is the primary condition for…
Q: Explain the concept of dynamic memory allocation in programming languages. What are its advantages…
A: In this question we have to understand about the concept of dynamic memmory allocation in…
Q: 3.8 Give implementation-level descriptions of Turing machines that decide the follow- ing languages…
A: Turing machines are theoretical fashions of computation that encompass a finite management unit and…
Q: I wrote out this circuit but need help to implement it into the two 7 segment displays
A: Implement a circuit into two 7-segment displays, follow these general steps: Determine the…
Q: Matlab
A: The question asks for the advantages and disadvantages of using local storage in Matlab and also to…
Q: How do I connect the below button which located in sidebar to the code. So how I want it to work is…
A: The first question is asking about how to connect a button in the sidebar to a function that will…
Q: 7. What is the output of the following code? fn main() { x = { let mut x: i32 = 12; println!("x is…
A: In Rust, the value of a block of code (enclosed within curly braces {}) is the last expression…
Q: 1. How does VLAN segmentation contribute to network security? Provide examples of security benefits…
A: VLAN segmentation is the process of creating different virtual networks that can function…
Q: * AHPA #23: Rounding Grades * * You are responsible for a class with five students: Tim, Mary,…
A: The given task revolves around managing the scores of students in a class and performing operations…
Q: Software development Use use case diagram can you draw the actors and use case not just…
A: Key references: Computer Science
Q: Create a R script to do the following• Create a vector ‘x’ with values from 100 to 109.• Create a…
A: The objective of the question is to create two vectors 'x' and 'y' in R, and then add these two…
Q: "Discuss the concept of Variable Length Subnet Masking (VLSM) and its significance in modern…
A: Variable Length Subnet Masking (VLSM) is a networking technology that allows for different subnet…
Q: 1). Write a java program that use the Canvas class to produce patterns by updating the code below.…
A: The objective of the question is to write Java programs that use the Canvas class to draw different…
Q: AHPA #24: Game Club * * You really enjoy playing the online game "PUBG: Battlegrounds". You *…
A: The given task involves creating a Rust program to manage player data for an online game club…
Q: Assume an attribute (feature) has a normal distribution in a dataset. Assume the standard deviation…
A: Then the outliers usually lie below -3S or above +3S. Explanation:In a normal distribution, outliers…
Q: Prepare the SPIM program for this question: Find the reverse of three numbers using numbers and an…
A: Prompt the user to enter three numbers.Store the numbers in an array.Calculate the reverse of each…
Q: Intellectual Property refers to creations of the mind, including inventions, designs, images etc.…
A: Summative Report: Disaster Recovery as a Service (DRaaS) for INFRATEL Author: [Your Name], Risk…
Step by step
Solved in 2 steps
- In python The text file “studentMarks.txt” has been provided for you. Each line contains the Last Name, First Name and 8 marks separated by spaces of a single student. For each student in the file, adjust the file to include the average of their top 6 marks, rounded to 1 decimal place, at the end of the line. For example, in the file, the line may say: Mars, Bruno 82 82 85 94 65 79 81 90 Afterwards, it should be updated to say: Mars, Bruno 82 82 85 94 65 79 81 90 Top6Avg: 85.7 Your program must define a function to determine the average of the top 6 marks. You may define more functions as needed for your program.python:def ohno_twozero(placeholder, statement): """ Question 1 - Regex You are typing a personal statement but accidentally used the number 0 instead of the letter o (the two are very close on the keyboard). After realizing this, seeing the mistake once does not bother you, but you absolutely cannot tolerate seeing it twice in a row. Therefore, you will need to replace any WORD where '00' shows up at any point with the given placeholder. Do not replace any NUMBER where 00 shows up. (e.g. '100' should stay as '100' and not be replaced with the placeholder). You may assume that when '00' shows up in a word, there will be at least one letter preceding it. Return the output string after making these changes. THIS MUST BE DONE IN ONE LINE. Args: placeholder (str) statement (str) Returns: str >>> ohno_twozero('epic', "I am n0w l00king at 500 t0tal h0urs 0n Super Smash Br0s.") "I am n0w epic at 500 t0tal h0urs 0n Super Smash…Please code in python Write code that translates a name into (simplified) Pig Latin. (Please do not make this a 'real' Pig Latin translator.) Have your script ask the user for his or her name, which can comprise first, middle, and/or last parts. For each name part, move the first letter to the end of the part and append the letters "ay". Make sure that only the first letter of each word in your output is capitalized. You can use the split() method on the string to create a list of the name parts. Be sure that your script can handle one, two or three name parts separated by spaces. This will likely involve a loop. Your script should re-create the following example exactly: Enter your name: Paul LaskowskiOutput: Aulpay Askowskilay
- IN PYTHON: Fill in the blanks to complete the “rows_asterisks” function. This function should print rows of asterisks (*), where the number of rows is equal to the “rows” variable. The number of asterisks per row should correspond to the row number (row 1 should have 1 asterisk, row 2 should have 2 asterisks, etc.). Complete the code so that “row_asterisks(5)” will print: * * * * * * * * * * * * * * * def rows_asterisks(rows): # Complete the outer loop range to control the number of rows for x in range(___): # Complete the inner loop range to control the number of # asterisks per row for y in range(___): # Prints one asterisk and one space print("*", end=" ") # An empty print() function inserts a line break at the # end of the row print() rows_asterisks(5) # Should print the asterisk rows shown abovePython Coding-(On Pycharm Community Edition) Create a mini-lottery with TEXT ticket. The user is going to save three numbers in a text file - those three numbers are from 1-9. In Python, create a program that reads those three numbers from the text file (ticket) Use a random number generator to draw three random numbers Compare the text ticket and the random numbers. If they match number (see below), output the prize The numbers can be in any order the random numbers can be duplicates, so be careful how you count! This work in a similar way to mini-assignment number 48 - but you DO NOT have to write to a text file. Have the user enter the numbers into the text file. Append the numbers read from the text file to a list read each number from the list and compare it to the randomly generated numbers you come up with One number match - free ticket Two numbers match - $2.00 Three numbers match - $10.00 -you don't have to complete bonus, it would be great if you could-…Modify the CharacterInfo class shown and included in the code editor to the right so that the tested character is retrieved from user input. An example of the program is shown below: Enter a character... R The character is R R is uppercase R is not lowercase After toLowerCase(), aChar is r After toUpperCase(), aChar is R R is a letter or digit R is not whitespace info> Do not edit the output statements. Task 01: Create the InputCharacterInfo class. Task 02: The InputCharacterInfo program displays the correct information for the input character.
- This is for Python version 3.8.5 and please include pseudocode. A file named gang.txt is shown below. Write Python code that opens this file, reads only the first two lines, and prints “Penny is 19” gang.txt (contents of file) - please create on with the data provided in order to complete this question. Thank you! Penny 19 Kenny 20 Benny 21 Jenny 20Python please: Using the template code as a starting point, write a program that reads a string of letters as input and produces output that is either a number or an error message. The output number should equal the sum of the values assigned to the letters (defined below). The program should output the error message if the input contains any characters that are not defined below. The error message should read "Error: Input contains an invalid character. Valid input characters are A, E, J, O, T, Z, YY." Your template code creates a list of letters and assigns each letter a number value: Letter Number A 1 E 5 J 10 O 15 T 20 Z 26 YY 50 NOTE 1: The final value in the list (YY) is a two-letter combination that must appear in full in order to be considered valid input. NOTE 2: A space is not a valid input character. HINT: You may use string[start:end] to parse the input string and extract the numeric integer for the "YY" combination. Example 1: If the input is TEA the…A python function opens file data.csv, reads the data from the file and spits the data into three columns, x, y and z. The data is then printed out. Function: f = open("data.csv ", "r") print('x\ty\tz'.format()) for row in f: temp = row.split(',') for cell in temp: print(cell,end='\t') print() data.csv contains: 1.2,2.1,1.1 2.3,3.2,0.6 0.7,1.9,0.1 1.8,2.5,0.3 4.6,2.7,0.9
- The file “dna.seq” (on Blackboard) consists of several DNA sequences. Write a program that reads in the file “dna.seq” and counts the number of sequences with the following properties:• The total number of sequences in the file• The number of sequences that have the pattern CTATA• The number of sequences that have more than 1000 bases• The number of sequences that have over 50% GC composition• The number of sequences that have more than 2000 bases and more than 50% GCcompositionUse pythonThe file "dna.seq" (on Blackboard) consists of several DNA sequences. Write a program that reads in the file "dna.seq” and counts the number of sequences with the following properties: • The total number of sequences in the file • The number of sequences that have the pattern CTATA • The number of sequences that have more than 1000 bases • The number of sequences that have over 50% GC composition • The number of sequences that have more than 2000 bases and more than 50% GC composition Some program requirements: (1) the program should prompt the user for the filename. (2) each of the above tasks should be its own function. dna seg file = CAAAGATTAAGCCATGCATGTCTAAGTATAAGCAATTATACCGCGAAACTGCGAATGGOTCATTAAATCACT TATCGTTTATTTGATAGTACCTTACTACATGGATAACCGTGGTAATTCTAGAGOTAATACATGOTAAAAAGO CCGACTCACGGAGGGTTGTATTTATTAGATTAAAAAThe file “dna.seq” (on Blackboard) consists of several DNA sequences. Write a program that reads in the file “dna.seq” and counts the number of sequences with the following properties:• The total number of sequences in the file• The number of sequences that have the pattern CTATA• The number of sequences that have more than 1000 bases• The number of sequences that have over 50% GC composition• The number of sequences that have more than 2000 bases and more than 50% GCcomposition