ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

ENG5322: Civil Engineering Skills

2020-11-13 19:31:56  阅读:300  来源: 互联网

标签:Civil list readings write Skills Engineering percentile file marks



ENG5322: Civil Engineering Skills M
Computer programming class test
10th November 2020
Instructions:
● 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) through
the 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 values
given 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 the
experimental data as the corresponding list. Write some code which loops over this
dictionary and outputs the mean and 50 percentile for this list in the format where XX below
are the respective values
Specimen: matA
Mean: XX
50 percentile: XX
Specimen: matB
Mean: XX
50 percentile: XX
Specimen: matC
Mean: XX
50 percentile: XX
….
[5 marks]
Write some code which gives overall mean and 50 percentile for all the data
Specimen: all_specimens
Mean: XX
50 percentile: XX
[5 marks]
Write some code which creates a second dictionary that comprises of the same materials
but has an additional specimen, for example, “matE”. You should write the logic to populate
the 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 axes
accordingly.
[5 marks]
Question 2 (20 marks)
You are asked to write a program that models the vibration of a cantilever beam. The
displacement 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)e−0.2t
代写ENG5322实验编程、代做Python留学生编程、Python程序设计调试Those with the numeric digits of the student IDs add up to an odd number will attempt:
u(t) = sin(kt)e−0.2t
where 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 above
function as an output.
[4 marks]
Using the function that you have just written, write file outputs for beam displacement where
k=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,k
0.0,0.0
0.2,0.194
….
[6 marks]
Next task is that once you are done generating the file, read from the file and write logic to
create two empty lists, t_list, and k_list, and then populate these lists with the values from
list, 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 a
daily 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.8
New readings have been taken of:
and the engineer has requested that these are added to the existing set of readings. Write
some code which creates the list of existing readings, adds the new values to the list and
then sorts the list in ascending order. Please note that the readings should be supplied in a
loop 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 will
attempt:
readings that lie between the plus or minus 10% of the average of all readings
Those with the numeric digits of the student IDs add up to an odd number will
attempt:
readings whose values are between 10% and 20% of the average
● and a final list containing all other readings
These above lists should be printed to the screen.
[10 marks]
Finally, he wants a line plot containing all the river level readings. This should contain
relevant axis labels.
[5 marks]

如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

标签:Civil,list,readings,write,Skills,Engineering,percentile,file,marks
来源: https://www.cnblogs.com/pythonnig/p/13970943.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有