_03 _ 2D Lists - Problem Set (1)

.pdf

School

The University of Queensland *

*We aren’t endorsed by this school

Course

COMP4702

Subject

Computer Science

Date

Oct 30, 2023

Type

pdf

Pages

2

Uploaded by CountValor1816

Report
2D Lists - Problem set Complete the following programs. Comment your code as necessary. Any prep work for the problems should be kept in your notebook. Be prepared to demo your solution during an upcoming class. Your code will not only be evaluated as producing a correct answer, it must also do so in an efficient, readable and well designed manner. 1. Create a function that accepts a 2D list tic tac toe board in the form: game_board = [ [ 0,1,2 ] , [ 0,1,2 ] , [ 0,0,0 ] ] and returns who the winner is: winner(game_board) # returns 1 Your Code: 2. Write a program to perform each task (in separate loops): a. Ask user to enter an integer n , then create a list of size n with all elements of the list set to 1 b. Ask user to enter n integers (some positive and some negative), and place the integers in the list starting with the first at the beginning of the list c. Switch the values at either end of the list d. Change any negative values to positive values (of the same magnitude) e. Set the variable sample_sum to the sum of the values of all the elements f. Print all the even numbers in the list Your Code:
3. Write a function that accepts a list and returns a copy of the list in reverse order. Do NOT use the name.reverse() method. Your Code: 4. Here is some data for a ICS2 class: marks = [ [None, "Clyde", "Pinky", "Blinky", "Inky"], ["OOP", 45, 75, 90, 80], ["Sorts", 57, 87, 90, 88], ["Project", 70, 88, 94, 84]] a) Write a function (called function_a ) that finds a student by name and returns the index of the column that they are in. b) Write a function that takes a column ID and returns the name of the student. c) Write a function that takes the column ID of a student and calculates the average for that student. d) Write a function that returns the name of student with the highest average g. List the student(s) whose average is higher than the class average Your Code:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: 6. HNO3/H2SO4 Nitration
Q: Problem 5.5: A kitchen oven has an interior volume V of 0.12 m³. The air in the oven is preheated…
Q: Discuss the different regions of the brain and the behaviors/functions they may be responsible for.…
Q: Madison Company purchased a machine on February 1, 2018, for $200,000. On December 31, 2021, when…
Q: Find a topic relating to the Boundedness of Convergent Sequences for a final project
Q: A(-3,4) -5 54 -3 -2 -1 a.) Domain: b.) Range: c.) f (-3) = d.) f (0) = e.) f (x) = 4 when x = f.) f…
Q: Write a java program that allows a user to enter more than one number to be tested for a series of…
Q: Treating an immediate expense as a capital expenditure: O overstates expenses and understates net…
Q: python help Implement function four_letter() that takes as input a list of words (i.e., strings)…
Q: An electric turntable 0.790 m in diameter is rotating about a fixed axis with an initial angular…
Q: 4. Show that Archimedean Principle is a consequence of the assertions that every interval (a, b)…
Q: Write a program named Fibonacci that prints the Fibonacci sequence of numbers. The first two numbers…
Q: If prices are rising and a company is using LIFO, large purchases of inventory near the end of the…
Q: Electrolytes that release hydrogen ions in water are Group of answer choices A) bases. B)…
Q: Overiew of IT Security Policy Framework
Q: Discuss the various biological steps that will take place in your body to extract the necessary…
Q: Using the provided budgeted information for production of 10,000 and 15,000 units, prepare a…
Q: Acetaldehyde (CH3CHO) is an important chemical both industrially and biologically. For instance, it…
Q: For each of the structures listed below identify the class of lipids to which it belongs (fatty acid…
Q: What is the highest score?   Question 18 options:   9   96   156   9156
Q: n accounting for by-products, when the by-products are sold for more than the estimated sales value,…
Q: ure. 2 ΚΩ 4 ΚΩ Μ Use the differential equation approach to find io(t) for t> 0 in the network in t =…