What is the output of the following code?
Q: A file concordance tracks the unique words in a file and their frequencies. Write a program that…
A: 1. Convert the text into upper case to avoid case mismatch 2. Remove the leading spaces and newline…
Q: 7. Operators with the same precedence are evaluated in which manner? a) Left to Right b) Right to…
A: operator with same precedence are evaluated from left to right for example: +,- operators have same…
Q: Question 17 Which one of the following is a valid Python if statement? if (y => 12) if (y >= 3) O…
A: The complete answer is below:
Q: There are 6 employees. Write a program with nested loops, to ask the yearly salary of each employee…
A: In this program, you need to take user input for salary of 6 employees for 5 years. After taking…
Q: In Pyhton, you get a Runtime Error when:
A: In step 2, I have provided answer with breif explantion------ In step 3, I have provided python…
Q: 21 python
A: Dictionaries are used to store data values in key:value pairs.
Q: 3 Question 1 Write a python program using while loop to find the sum of the below given series up to…
A: Algorithm: Start Read n value Initialize sum=0 While n>=10 Calculate sum =sum+(5/n) After…
Q: 6. Which of the following is an invalid variable? a) my_string_1 b) 1st_string <) foo -
A: Given, Choices: my_string_1 1st_string foo _ We have to find among the given choices which is…
Q: 9. Which of the following is an invalid statement? a) abc = 1,000,000 %3D b) abc= 1000 2000 3000 c)…
A: lets check each option: a)abc =1,000,000 # it is valid : it is declaration of tuple: abc =…
Q: 1- Write a Python program to count the number of even and odd numbers from a series of numbers…
A: Solution for question 1: lst1 = [4,9,1,17, 11, 26, 28, 28, 26,66,91] even, odd= 0, 0 for i in lst1:…
Q: What is the output of the following code? set1 = {"John", "Mary", "Sam"} set1.add("David")…
A: Answer: {’Mary’, ’Sam’ , ‘John’ , ‘David’}
Q: What is the put put of? print(int("one")) Runtime Error Syntax Error 0 1 O One
A: Answer Syntax error
Q: A main function that tests the conversion function with numbers in several bases has been provided.…
A: def repToDecimal(str,base): result = 0 #initializing a dictionary…
Q: Given the nested if-else below, what will be the value x when the code executed successfully X = 1 a…
A: Answer 4
Q: Write a Python program that chooses the best 5 quiz scores from a file with student ID and scores.…
A: In this program we need to first open the file and then extract the student id and list of scores.…
Q: What is the output of the following if statement? a, b = 12,5 if a + b: print('True') else:…
A: OUTPUT
Q: Given the nested if-else structure below, what will be the value of x after code execution completes…
A: The complete answer is below:
Q: What is the output of the following? x = {"apple", "banana", "cherry"} y = {"google", "microsoft",…
A: Dear Student, The output of the code is {'apple'}. This is because the intersection_update method…
Q: What is the output of this code? myList=[22,15,24,13] if (myList[0] > myList[1]): print(myList[0:2])…
A: code:
Q: Write a python program that takes a list and removes the duplicates from the list.
A: Note: As per our company guidelines, we are supposed to answer only one question. Kindly repost…
Q: • Exercise # 2: Implement a class Portfolio. This class has two objects, checking and saving, of the…
A: CODE IN PYTHON: class BankAcount: def __init__(self, initialBalance = 0.0):…
Q: In python, create a class horse that inherits the following attributes and methods from its parent…
A: #Parent class class Animal: #constructor def __init__(self,common_name, given_name, weight):…
Q: name.txt", b) opens the filename that was read, and writes into it "CIS 150". No validation/error…
A: Python used to answer this question
Q: DESCRIPTION This is a variation of earlier program. Using the while loop Write a program to input…
A: A required program is as follows, flag = True below25000 = 0 below50000 = 0 below100000 = 0…
Q: init (self, radius) Creates a sphere having the given radius. getRadius (self) Returns the radius of…
A: python code " class Spheres: def __init__(self,radius): self.radius = radius…
Q: v Input Format For Custom Testing A list containing N tuples representing the X-Y coordinates. v…
A: The program is written in python. def find_dist(x,y): d=((y[0]-x[0])**2+(y[1]-x[1])**2)**(1/2)…
Q: What is the output of the following?
A: Dear Student, The code returns the keys of the car dictionary in a list which is ['brand', 'model',…
Q: Which of the following statemer O Protected members of a class Private members of a class ca The…
A: Which of the following statements is wrong about inheritance? Protected members of a class can be…
Q: Which of the following best describes inheritance? Ability of a class to derive members of another…
A: GIVEN:
Q: The Directory.txt file contains names of the employees and their phone numbers in the following…
A: Required:
Q: Question 24 What is the output of the following? x = ("apple", "banana", "cherry") y = list(x) y[1]…
A: The Python list() constructor returns a list. The Python tuple() builtin can be used to create…
Q: Write a program that inputs a text file. The program should print the unique words in the file in…
A: Start Read file Read word by word Store all unique words Sort all words Print the sorted words Stop
Q: Slide Type Fragment v • Exercise # 1 Write a program that reads a file containing text. Read each…
A: In step 2, you will get python code. In step 3, you can see the sample output.
Q: 3. Write a python program to calculate sum oft (Use any loop) 2 4 6 8 10 12 14
A: here in this question we have given a series and we have to find sum of that series using some…
15 python
Step by step
Solved in 2 steps
- Use Python code with: "def recolorImage(img,color):" without using cv2 or PIL recolor(img, color) - Changes all non-white pixels of the image referred to by the parameter img to the specified color, and returns a new image with the changes. img is a 2D array of RGB pixels which represent images. color is a list containing 3 integers, each from 0 to 255, representing RGB values. To create a new image use the cmpt120image.getBlackImage() function which returns a new canvas to draw on.# Debug the following program and submit the CORRECT version ####### Lists names = ["chris","dan", "edgar", "bonnie", "al", "fran"] usernames = ["202999", "100345", "299999", "309890", "298765", "345678"] passwords = ["password", "password123", "abcdef", "asdfjkl;", "ilovemom", "abc123"] menuChoice = 0 # user's menu choice ###### functions def printList(list):# print listprintprint(list)print def displayMenu():# displays user-friendly, creative menu printprintprint("******* MENU *******")print("1. (D)isplay list 1 in original order")print("2. D(I)splay list 2 in original order")print("3. (F)ind an item in the list 1")print("4. (L)ogin")print("99. (E)xit")printprint def isFound(list, value):# finds a value in list returns True if found, False otherwiseif (value in list):return Trueelse: return False ###### main program while (menuChoice != "99"):displayMenu()menuChoice = input("Enter a menu choice: ")# handling menu choices if (menuChoice == "10" or menuChoice.upper().strip() ==…(Python matplotlib or seaborn) CPU Usage We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight. Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart: When does the worker typically take lunch? Did the worker do work on the weekend? On which weekday did the worker start working on their computer at the latest hour? cpu_usage = [ [2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23, 45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday [1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44, 33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday [2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31, 54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday [1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18, 41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday [4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27, 43, 8,…
- Do code in c++.Dont use string and built in Functions .Use only #include<iostream> header file . Use 2d array.Design void printStart(char *str, char ch). We know that str contains only uppercase words and Spaces, and the first and last characters are not Spaces, and there is only one space between two adjacent words. Ask to print all words in str beginning with the capital letter ch, separated by Spaces, on the screen. (please use c++)Python question Application: Python Fragment Formulation (Q1 – Q4) In this group of questions you are asked to produce short pieces of Python code. When you are asked to "write a Python expression" to complete a task, you can either give the expression in one line or break down the task into several lines. The last expression you write must represent the required task. Question 1 (Reduce parentheses) Give an equivalent version of this expression by removing as many redundant parentheses as possible, without expanding the brackets or simplifying. (x**(2**y))+(y*((z+x)**3)) Question 2 (Translate arithmetic concept into Python) You are given a list of numbers, named numbers, containing 3 integers. Write a python expression (one line) that evaluates to True if and only if the product of any two numbers in the given list is greater than the sum of all three numbers. Note: the product of two numbers, x and y is x*y. Question 3 (List/table access) You are given a table,…
- in Ccode bellow for ch in "john.smith@pythoninstitute.org": if ch == "@": break print (ch, end="")| Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it reaches after the @ symbol, and print the part before @ on one line. Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it complete the loop. Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it reaches before the @ symbol, and print the part before @ on one line. none of the above Create a program with a for loop and a break statement. The program should iterate over characters in an email address, exit the loop when it reaches the @ symbol, and print the part before @ on one line.i dont understand the step in the loop
- Based on the output below, create a C++ program that will include the new and delete operator. Interpret your program; you may include comments in interpreting your own program.SAMPLE OUTPUT: [Enter your own grades]Enter the number of grades to be processed:Enter a grade: 87Enter a grade: 88Enter a grade: 89Enter a grade:90An array was created for 4 integers The values stored in the array are:87888990ENGAGE MINDTAP -Using a Counter-Controlled while Loop in Java Using a Counter-Controlled while Loop ? Summary In this lab, you use a counter-controlled while loop in a Java program provided for you. When completed, the program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. The data file contains the necessary variable declarations and some output statements. Instructions 1. Ensure the file named Multiply.java is open. 2. Write a counter-controlled while loop that uses the loop control variable to take on the values O through 10. Remember to initialize the loop control variable before the program enters the loop. 3. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. Remember to change the value of the loop control variable in the body of the loop. 4. Execute the program by clicking Run. Record the output of this program. Grading When you have completed your program, click the Submit button to record your…Problem Definition Task. Your task is to develop a python program that reads input from text file and finds if the alphanumeric sequence in each line of the provided input file is valid for Omani car license plate. The rules for valid sequences for car plates in Oman are as follows: Each sequence is composed of 1 to 5 digits followed by one or two letters. Digits cannot start with 0, for instance, 00, 011, or 09 are not valid digit sequences. The following list are the only valid letter combinations: ['A','AA','AB','AD','AR','AM','AW",'AY"', 'B', BA','BB','BD',"BR','BM',"BW',"BY', 'D','DA','DD','DR','DW','DY', 'R','RA','RR','RM','RW','RY', 'S','SS', 'M','MA','MB','MM','MW','MY", "W',"WA',WB',"wW', Y,YA','YB','YD','YR','YW',YY] Program Input/Output. Your program should read input from a file named plates.txt and write lines with valid sequences to a file named valid.txt. Any line from the input file containing invalid sequence should be written to a file named invalid.txt. Each line…