CAN SOMEONE PLEASE HELP AND ANSWER THIS Introduction to computing and IT question
----------------------------------------------------------------------------------------------------------------------------------------------------------------
this is the file required for the question
Question 4 a:
Question 4 b:
b(i)
Given width, length and height of a brick, we will first calculate the volume of a single brick. We are also provided with the number of bricks required, so we multiply number of bricks with volume of single brick to get the total volume of all the bricks.
Since 1 cm3 weighs 7 grams, we multiply total volume of all bricks with 7, to get the amount of total material required.
b(ii)
amount_of_plastic(width_brick,height_brick,length_brick,number_of_bricks):
volume_brick = width_brick * height_brick * length_brick
total_volume = volume_brick * number_of_bricks
plastic = total_volume * 7 return plastic
b(iii)
CODE:
def amount_of_plastic(width_brick,height_brick,length_brick,number_of_bricks): volume_brick = width_brick * height_brick * length_brick total_volume = volume_brick * number_of_bricks plastic = total_volume * 7 return plastic
OUTPUT:
CAN SOMEONE PLEASE HELP AND ANSWER THIS Introduction to computing and IT question --------------------------------------...
Imagine that a company in the freight transport business has commissioned you to solve the following problem. Given bulk cargo with a certain weight per m3, compute the volume of that bulk cargo in m3 that a single 40-foot standard container can hold. A standard 40-foot container: has an internal volume of 67.5 m3 a maximum net load of 26199 kg . For instance, 1 m3 of gravel weighs 1800 kg. Because the maximum net load of a container is 26199 kg, a single container can only hold 14.555 m3 of gravel, otherwise it would exceed the maximum net load. For comparison, 1 m3 of wood chips weighs 380 kg. Because the maximum net load of a container is 26199 kg, based on the maximum weight, it is allowed to hold 68.94 m3 of wood chips. However, the internal volume of a single container is only 67.5 m3, so a single container can hold 67.5 m3 of wood chips. In answer to this question you will need to decompose the problem, write an algorithm, and implement the algorithm as a single python function that returns the total volume that can be held by single container. i.Include your initial decomposition of the problem in your solution document using the chevron notation (> and >>) ii.Include the algorithm for solving the problem in your solution document. Part iii of this question involves writing one Python function definition. —— Draft Code—— def volume_per_container(kg_cargo_per_cubic_metre): """Given the kg of cargo per cubic metre, calculate how many cubic metres of cargo can be stored in a single container.""" # INSERT YOUR CODE BELOW FOR CALCULATING THE # TOTAL WEIGHT AND RETURNING THE RESULT (DO NOT CHANGE # THE HEADER OF THE FUNCTION WHICH HAS BEEN PROVIDED FOR YOU # ABOVE) # DO NOT CHANGE THE CODE BELOW # The code below automatically tests your function # If you run this file before making any changes to # it, you will get an AssertionError. # Once you have completed the file with correct # code, the AssertionError should no longer appear and # message "tests passed" will appear in the shell. def test_volume_per_container(): """Test the volume_per_container function.""" # Test for gravel at 1800 kg per cubic metre assert volume_per_container(1800) == 14.555 # Test for wood chips at 380 kg per cubic metre assert volume_per_container(380) == 67.5 print ("tests passed") test_volume_per_container() ——— End Draft Code———— Write your Python function definition for volume_per_container() in the draft code where indicated. Note that the Draft Code already contains code for automatically testing the function volume_per_container(). You must not change this code. iv. Provide a Python function that implements the algorithm. Follow the instructions above for submitting code. Your answer must be a translation of your algorithm from part (ii) above
A car park management system uses a list to represent which spaces in a car park are currently occupied and which are currently unoccupied. An empty space is represented by a 0 and a full space by a 1. Then the state of the car park would be represented by the following list: [1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0] The designers of the car park management system require a program that will accept a list such as the one above (although of course the length will not always be 11) and calculate what percentage of the spaces are currently occupied, rounded to the nearest percent. In the example above 7 spaces are occupied and there are 11 altogether, so the percentage occupied is: (7 / 11) x 100 = 63.63… = 64% to the nearest whole number. i.What are the admissible inputs of the problem? ii.What is the output of this problem? iii.Write three tests for this problem. The inputs should be different from the example given in the scenario description above. At least one of your tests must be a borderline case. Present the tests in a table, with a column for each input and output, and an extra column with a brief explanation of why you selected each test iv.Decompose the problem into sub-problems. Use the > notation and state in brackets the type of the problem and of each sub-problem v. Choose the patterns for the subproblem types you identified, instantiate the patterns into an algorithm, and translate the algorithm into code.This part of the question involves writing Python code. Write your code in this file and then submit the completed code file as part of the answer to this part of the question. Note: Although Python has a built-in function to find the sum of a list, please do not use it to compute how many 1s there are in the list. We want you to write your own code , because the purpose of this question is to practice following the problem solving approach described there, which will equip you to solve problems in other cases for which there is no built-in Python function. A Python program which is not preceded by a corresponding decomposition will gain at most half marks. Again, the reason for this is that we want you to follow a systematic problem-solving approach and not dive straight into code. Please therefore make sure that you have supplied an answer to iv. If you find it difficult to get the decomposition quite right at first there is no reason why you cannot review it when you have written the code. The main thing is to have a clear idea of what the solution needs to do (the decomposition) that ties in correctly with how it does it (the program). Make sure you use appropriate variable names and comments and that you have tested your code with the inputs of your test table. (Keep each of your test inputs in your code, but precede all of the test inputs, except for one, with the # symbol. Recall that # signals a comment, which is ignored by the Python interpreter.)
Please answer this question using python programming only and provide a screen short for this code. Homework 3 - Multiples not less than a number Question 1 (out of 3) This homework is a SOLO assignment. While generally I encourage you to help one another to learn the material, you may only submit code that you have composed and that you understand. Use this template to write a Python 3 program that calculates the nearest multiple of a number that...
Can you send the code and the screenshot of it running? 1) Create a PYHW2 document that will contain your algorithms in flowchart and pseudocode form along with your screen shots of the running program. 2) Create the algorithm in both flowchart and pseudocode forms for the following two functions: A. Write a Python function that receives a real number argument representing the sales amount for videos rented so far this month The function asks the user for the number...
Answer in python 3 and can you please include a screenshot of the code and the output Problem 4 (Quicksort) For this problem you must implement the recursive quicksort algorithm covered in lecture to sort points based on their distance from the point (0, 0). Crete a Python file called quicksort.py and implement a function called quicksort(list) that does the following: COMP 1005/1405A – S19 – A5 Due Saturday, June 15th at 11:59 PM 3 1. Takes a 2D list...
PYTHON I need help with this Python problem, please follow all the rules! Please help! THANK YOU! Bonus Question Implement an efficient algorithm (Python code) for finding the 11th largest element in a list of size n. Assume that n will be greater than 11. det find 11th largest numberlissy Given, lissy, a list of n integers, the above function will return the 11th largest integer from lissy You can assume that length of lissy will be greater than 11....
MATLAB Please fix the error. Thank you!! Given the following piecewise function, f(x) Create a function M-file, PieceZig, that accepts one number as input, evaluates the piecewise function at that number & returns this as output. Do not allow the user to enter an armay of x values Examples Piecezig (1e) Piecezig (2) ans 2 Your Function 1 function fx PieceZ1g(x) 5 elseif ((-5 <= x)&&(x<= 5)) fx = x; 7 elseifx> 5 end end Test 1 Pretest) Test 2...
PYTHON please help! im stuck on this homework question, THANK YOU! please follow the rules! Give a recursive python implementation of the following function: def check_Decreasing_Order(lissy): Given lissy, a python list of integers, the above function will return True if lissy is sorted in decreasing order, otherwise it will return false. For example, print(check_Decreasing Order([100,50,8, -2])) True print(check_Decreasing_Order([108,50,8,2,35])) False Implementation Requirements: 1. Your implementation must be recursive. 2. If you need more parameters, you may define new functions or helper...
Your task is to: 1. Introduce function documentation (the triple-quoted string that precedes the definition of a Python function) 2. Make sundry changes to improve the readability of the code. This might include: 1. Be sure to change the function names to something appropriate. 2. If there are any "gotchas" or assumptions about the input, document those. 3. If the variables are poorly named, change the variable names. 4. If the logic is needlessly complicated or redundant, abbreviate it. 3....
In matlab, I keep getting the same issue for this problem can someone help? "myrowproduct.m" >> Filename myrowproduct (A,x) Undefined function or variable 'Filename' Did you mean: mfilename : myrowproduct (A, x) Undefined function or variable 'myrowproduct' function y = myrowproduct(A,x); function y my rowp roduct (A, x); Error: Function definition not supported in this context. Create functions in code file. (, 2,,)T 4. The product y Ax of an m x n matrix A times a vector x= can...