(python) 11. Identify and fix the errors in the following code. There are a total of 8 errors. listInt = [ 1, 2, 3, 4, 5 ) listFloat = [} totalDiff == 0 for x in range(5): listFloat.add(listInt[x] * 1.5) print(str(listInt[x]) + " * 1.5 = + str(listFloat[x])) totalDiff += listFloat[x] - listInt[x]; print “Total increase of “ + str(totalDif))
Q: identify 8 Errors in the following code give a reason why .
A: Error 1: as method is static but return variable is not static. Error 2: as val variable is…
Q: The Government of United States of America has decided to issue new currency notes with special…
A: Code is below:
Q: Write a C++ code to insert the following numbers in the Linked List. 5, 78, 45, 11, 89, 10, 78, 6,…
A: #include <iostream>#include <list>#include <iterator>#include <map>using…
Q: Write a python program that takes 5 positive integers from the user and prints the list after…
A: Please find the answer below :
Q: st, and pointers shall be used in this program. Kindly use only SELECTION, ITERATION, INPUT, AND…
A: #include<iostream> #include<fstream> #include<windows.h> #include<string>…
Q: 2B. Given x=3 and y=6, what is the value of z after the expression z=x*y==18 is executed?
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: What is “std::length_error”? Use this in any C++ code where must use your reg# as length_ error??
A: What is “std::length_error”? This defines the object type that to thrown as an exception, it also…
Q: In c++ , perform data traversal before and after deletion operation. ( Drop code in words , explain…
A: Here is the program to perform data traversal before and after deletion operation in Data Structure…
Q: Write some C++ code that will read a line of text and echo the line with alluppercase letters…
A:
Q: - Show the printout of the following code:
A: bool b = true;int i = b; cout << b << endl;cout << i << endl;
Q: 18 - What is the output of the following code segment in C ? int a=5%; c= fork(); if (c==0) { a =…
A: When the fork() function was called. for the child process, 0 was successfully initialized to c for…
Q: Write a python code 2) Write a function listsort which accepts a list as a parameter, and sorts it…
A: - We have to order the list in ascending form and return it. - We used bubble sort to do the work.
Q: void main() enum d{ mon=-1,tue,wed%36,thu,fri,sat}; printf("%d%d%d%d%d%d*,mon,tue,wed,t hu,fri,sat);
A: Please find the answer below :
Q: Hi! Could you help me? I think something is wrong with my code but I couldn't figure out what. Also,…
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Q: 2. What is wrong in the following code?
A: The above mentioned code doesn't executes because Explanation: In the above code there is a missing…
Q: What does the following Python code return? def func(x,y): if (x == 0): return y else: return func…
A: ANSWER : Option d is correct answer Explanation : When we run the code: In first iteration:…
Q: - (Data processing) Write, run, and verify a C++ program that accepts three numbers as input, and…
A: // C++ program to sort an array of size 3 #include <algorithm> #include <iostream> using…
Q: How do you use the"write" system call in C++ to print out any variable? How do you use the "write"…
A: While doing programming in any programming language, you need to use various variables to store…
Q: C++ to Python. How can I rewrite this code, using Python List Comprehension?
A: Given: C++ to Python rewrite this code, using Python List Comprehension.
Q: C++ to Python. How can I rewrite this code, using Python List Comprehension? Please, help! #include…
A: The problem is about converting c++ code into python code.
Q: Complete the code as below mentioned. Write all
A: Here, in this question, we are asked to develop a GO code. It is stated that the amount of potatoes…
Q: What is the list created by the following Python statements? 1s = list(range(10, 21, 5))…
A: Please find the solution in the below step
Q: ease Use Python ## Given the stubs for the following function ## and the main program, complete…
A: # Given the stubs for the following function# and the main program, complete them# to output the…
Q: please help me modify the sparse text program below so that instead of the letter 'e' being removed,…
A: We need to update the code to accept the letter after that we need to remove it from the file.
Q: 5. Rewrite the following code using a switch statement.
A: Approach Here, we are asked to replace if else-if with a switch statement. We will use the switch…
Q: ow to write C++ program that reads a list of nine digit number from the keyboard. It stores the…
A: According to the question we have to write a C++ program that reads a list of nine-digit numbers…
Q: Q4: Write a program to sort the following list of numbers ascendingly. L=[15,6,8,19,10,17,7,22,5,14]
A: As you have not mentioned the coding language i am providing the solution in java: Code: public…
Q: Write a C++ code to insert the following numbers in the Linked List. 5, 78, 45, 11, 89, 10, 78, 6,…
A: Program: // Include necessary header files#include <iostream>using namespace std;//…
Q: 2B. Given x=3 and y=6, what is the value of z after the expression z=x*y=%=18 is executed?
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: 3- Write a C# program that read a string and split this string according to a set of chars( space,…
A: Program: using System;class Program{ static void Main() { // To store input string…
Q: Identify and fix the errors in the following code:
A: The java.lang.Math.random() returns a double value with a positive sign greater than or equal to 0.0…
Q: Suppose we have a string holding the text of an entire book. If we want to analyze segments of the…
A: Answer : I have code in java and insert in next step.
Q: 2- Write a C# program that read a string and split this string according to space char into an array…
A: A space ( ) separated list of items from a file and we want individual items in an array. Almost…
Q: Q7: The Fibonacci Series is: 0, 1, 1, 2, 3, 5, 8, 13, 21, .. It begins with the terms 0 and 1 and…
A: According to the Question below the Complete Program: Program Output:
Q: Writea C++ code (using a function) to read an integer value time (T) and convert it to equivalent…
A: Q1. Algorithm Start int time, min, hour Print("Enter time") Accept time hour=time/60…
Q: What is the content of the list Is2 when the following Python statements are executed? 1s1 =…
A:
Q: 2. Write a C program which implements the matrix multiplication process. To multiply two matrices,…
A: Screenshot of the C program is as follows:-
Q: correct way to assign the pointer p to the address of x
A: Introduction to the concept of the pointer: Pointers are the symbolic representation of the…
Q: en inline, bl
A: The difference between inline, block and inline-block?
Q: a- Write a Python function Salary_levels, that takes a list as an argument and returns the number of…
A: You can return many values from function as tuple and this is the beauty of Python
Q: Write a C++ program, using function, to compute the number of zeros in the array.
A: The above question is coded in C++.
Q: Choose the correct answer for following piece of C++ code void func(int a, int &b) cout<<a<<"…
A: I have given the answer below.
Q: Computer Engineering Lab The Government of United States of America has decided to issue new…
A: Program Explanation First-line contains T the number of test-cases. Every test-case contains an…
Q: Please give some examples on how to use the following in Python. Please do example codes Bool, int,…
A: Please refer below for your reference: Language used is python:…
Q: Please code in python Kiki is making “Happy National Pizza Day” (February 9th) cards for all of her…
A:
Q: In Python, how do we sort a dictionary by values, without importing any additional modules? You…
A: 1) we have a dictionary {'a':11,'e':2,'v':32,'c':4} ans we need to sort it by values d =…
Q: Use the Design Recipe to write a function round_list, which consumes two arguments, a list of floats…
A: I have provided a solution in step 2.
Q: Trace the output of the following code
A: I have provided C++ CODE , CODE SCREENSHOT and output with OUTPUT…
(python)
11. Identify and fix the errors in the following code. There are a total of 8 errors.
- listInt = [ 1, 2, 3, 4, 5 )
- listFloat = [}
- totalDiff == 0
- for x in range(5):
- listFloat.add(listInt[x] * 1.5)
- print(str(listInt[x]) + " * 1.5 = + str(listFloat[x]))
- totalDiff += listFloat[x] - listInt[x];
- print “Total increase of “ + str(totalDif))
Step by step
Solved in 2 steps
- Python Programming:- thislist = ["apple", "banana", "melon", "cherry", "orange", "kiwi", "mango"] # Using the given list above, write a quick python script that## a. First, outputs only the FIRST 3 elements from the list# b. Second, outputs the LAST 3 elements from the list# c. Third, outputs ONLY the elements whose first letter is "m"# d. Last, outputs ONLY the last element from the listUsing the following instruction below, write a header class for orderedLinkedList with a function of search,insert, insertFirst, insertLast and deleteNode. Use the library to write a c++ program to show an operation on an ordered linked list. - include the orderedLinkedList.h library in the codes - Create main function and include your information details - initialize a list1 and list2 as orderedLinkedList type - Declare a variable num as integer data type - Print out an instruction for user to input a numbers ending with -1 - Get a numbers from user input - Use a while loop to insert the numbers into list1 ending with -1 - Assign the list2 to list1 - Print out the current elements in List 1 and 2 - Get user input for the number to be deleted - Delete the number requested by user in list2 - Print out the elements in the list1 and list2 after delete operationPart 2: Binary Arithmetic One of the most common operations we perform on binary numbers (and all numbers) is addition. It can be cumbersome to convert your binary numbers to decimal just to add them and convert them back, so instead we will be learning how to add binary numbers directly. Binary addition works the same way as decimal addition, with the added restriction that each digit can only go up to 1. Let's consider the possibilities for adding the values of any 2 single digits together: 0 + 0 0 + 1 1 + 0 1 + 1 0 1 1 10 (remember that 10 in binary represents the number 2) In that last case, the result is larger than a single digit. When adding larger binary numbers, that means we have to carry the 1 over to the next column. This presents us with another new case: what happens if we have 1 + 1 + carried 1? In that case, the result is 11, which means that column's result is 1, and we carry 1 to the next column. Below is an example of adding two binary numbers that shows all…
- Write C++ statements to do the following. Make p point to an empty list.Fibonacci’s sequence starts with values 1 and 1. The next value in the sequence is formed by summing the previous two values. Thus the third value is 1+1=2, the fourth is 1+2=3, the fifth is 2+3=5, etc. Thus, the sequence is 1, 1, 2, 3, 5, 8, 13, 21, …. Write a code fragment using c++ that obtains a positive integer n from the user and displays the sum of the first n numbers in the Fibonacci sequence. If n is not positive, use cout to print out an error message. Put this code fragment in your main() of your project.1) - 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.
- Problem Description We've already made arraying/listing the easy way, but how about arraying/listing and printing the list in reverse order? Make a program that will input an integer and then using loops, add items on an array/list one by one for the same number of times as that of the first inputted integer. Then, print out the array/list in reverse order, that is, starting from the last item on the array/list down to the first one, each in separate lines. Input The first line contains the size of the array/list. The next lines contains the items of the array/list (integers). 5 1 64 32 2 11 Output Multiple lines containing integers. 11 2 32 64 1 Problem Description Did you know that you can also reverse lists and group them according to your liking with proper code? Input The first line contains an odd positive integer. The next lines contains an integer. 5 1 3 4 5 2 Output A line containing a list. [2,5]-[4]-[3,1] -USED JAVA PROGRAMMING LANGUAGE1.Write program to iteratively compute Fibonacci numbers (named after an Italian mathematician).Some Fibonacci numbers are 1, 1, 2, 3, 5, 8, ... where the next number is found by summing the preceding two numbers. Your program will read in a number, like 7, report the first 7 numbers. in this case1,1,2,3,5,8,13. Your program is not assured of receiving good data, thus if -2 is received as the number of numbers, then an error should be reported.PYTHON Problem Statement Given a list of numbers (nums), for each element in nums, calculate how many numbers in the list are smaller than it. Write a function that does the calculation and returns the result (as a list). For example, if you are given [6,5,4,8], your function should return [2, 1, 0, 3] because there are two numbers less than 6, one number less than 5, zero numbers less than 4, and three numbers less than 8. Sample Input smaller_than_current([6,5,4,8]) Sample Output [2, 1, 0, 3]
- C1- a- Write a Python program to input user’s name and how many people are in the dinner party tonight. If the number of people is more than 8, print a message that they have to wait, otherwise print that table is ready. In both situations the message must mention the user name as follows: I’m sorry, Sameh has to wait for a table. OR Sameh’s table is ready b- Remove all instances of “dog” from the list where pets = ['dog', 'cat', 'dog', 'goldfish', 'cat', 'rabbit', 'cat']. Display the list before and after removing.- Write a java program that contains a two-dimensional array of 2 rows and 3 columns. Find the sum of each row in the array, trace the code using a tracing table. - Note: No two students can try the same inputs. - You should submit the code and the tracing table in a handwritten pdf file. - Also, you should submit the code and a screenshot of the output using a word file. Tracing Table may look like the following table: Line# i j Array[0][0] Array[0][1] Array[0][2] Array[1][0] Array[1][1] Array[1][2] rowSum Output …….Please Use Python ## Given the stubs for the following function ## and the main program, complete the implementation.## Finish the assert statement to properly## assert the result shown below (be careful ## with the types of the variables). def get_list_odd(): """ Given a list of numerical values, return a new list that contains the odd elements on the list. If the list is empty, return -1. For example, if the list contains [10, 1, 6, 3, -1, 5, 9] the function returns [1, 3, -1, 5, 9] """ passif __name__ == "__main__": ### Write 3 assert statements ### to test the function assert ...