” 辅导ENG5322实验编程、 写作Python留学生编程ENG5322: Civil Engineering Skills MComputer programming class test10th November 2020Instructions:● You are given 90mins to complete all questions.● The test comprises of 3 questions each with 20 marks available for each (60 total).● When finished, you must submit your complete Python notebook (.ipynb file) throughthe test submission page on Moodle, along with pasted solution in a word document.● This is an open book test and therefore you are free to use lecture and lab notes.● You must not confer With other students during the test.Good luck!Question 1 (20 marks)An engineer has performed various measurements on different materials with the valuesgiven as follows:matA [194.7, 215.2, 200.5, 197.3, 205.3]matB [65.5, 73.4, 71.2, 68.5, 75.8, 66.9]matC [23.4,34.5,45.6,27.5,56.5,45.5,47.9]matD [110.4, 103.5, 129.4, 115.4, 123.2, 110.2]Create a dictionary from the above data which uses the material name as the key and theexperimental data as the corresponding list. Write some code which loops over thisdictionary and outputs the mean and 50 percentile for this list in the format where XX beloware the respective valuesSpecimen: matAMean: XX50 percentile: XXSpecimen: matBMean: XX50 percentile: XXSpecimen: matCMean: XX50 percentile: XX.[5 marks]Write some code which gives overall mean and 50 percentile for all the dataSpecimen: all_specimensMean: XX50 percentile: XX[5 marks]Write some code which creates a second dictionary that comprises of the same materialsbut has an Additional specimen, for example, matE. You should write the logic to populatethe values for this material in a loop until the user types the word stop.[5 marks]Finally, produce a bar chart of each material type and its reading. Label your axesaccordingly.[5 marks]Question 2 (20 marks)You are asked to write a program that models the vibration of a cantilever beam. Thedisplacement of the beam is given by the following function:Those with the numeric digits of the student IDs add up to an even number will attempt:u(t) = cos(kt)e0.2tThose with the numeric digits of the student IDs add up to an odd number will attempt:u(t) = sin(kt)e0.2twhere u is the displacement of the beam, k is a vibration constant and t is the time variable.Your first task is to write a function that takes two arguments: k and t and returns the abovefunction as an output.[4 marks]Using the function that you have just written, write file outputs for beam displacement wherek=0.1, and t varies From 0.0 to 20 in steps of 0.2. Make sure that while outputting the file,the file follows the following structure:t,k0.0,0.00.2,0.194.[6 marks]Next task is that once you are done generating the file, read from the file and write logic tocreate two empty lists, t_list, and k_list, and then populate these lists with the values fromlist, and print them on the screen:Hint:t_list=[]k_list=[]for line in file:record=line.split(,)#i.e., splitting line into a list# record[0] contains t# record[1] contains k# other logic comes here to populate t_list, and k_list[5 marks]Finally, for k=0.3, plot the vibration of the beam between 0.0 and 10 using steps of 0.01.Label your axes accordingly.[5 marks]Question 3 (20 marks)You are asked to produce a program for analysing river level readings which are taken on adaily basis. The engineer has already taken a set of readings given by:8.3, 7.3, 3.9, 4.5, 4.9, 6.2, 5.2, 5.6, 10.1, 2.4, 8.9, 4.7, 11.2, 2.5, 4.8New readings have been taken of:and the Engineer has requested that these are added to the existing set of readings. Writesome code which creates the list of existing readings, adds the new values to the list andthen sorts the list in ascending order. Please note that the readings should be supplied in aloop as a user input until the user types end.[5 marks]The engineer wants the data to be sorted into two lists: Those with the Numeric digits of the student IDs add up to an even number willattempt:readings that lie between the plus or minus 10% of the average of all readingsThose with the Numeric digits of the student IDs add up to an odd number willattempt:readings whose values are between 10% and 20% of the average● and a final list containing all other readingsThese above lists should be printed to the screen.[10 marks]Finally, he wants a line plot containing all the river level readings. This should containrelevant axis labels.[5 marks]如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。