Enrolled 'Master Jenkins CI For DevOps and Developers'!

在Thoughtworks第一次接触pipeline等概念后,非常认同由Jenkins pipeline串联起来的开发-测试-部署这个工作模式,试听了下这个课程,instructor是James Lee,可能是位华裔,口音好听多了,而且课程设计可称的上是精致,确实是认真备课过的。目前已经完成了好几章了,很是喜欢。目前的问题的是学的太快,急需总结。

Sure! For reading and processing the CSV file, we can use the `csv` module in Python. Here's the code to read and collect all the scores in a list: ```python import csv scores = [] with open('midterm.csv', newline='') as csvfile: reader = csv.reader(csvfile) next(reader) # skip header row for row in reader: scores.append(int(row[1])) print(scores) ``` This code will create a list `scores` containing all the numeric scores from the CSV file. For the second part of the question, we need to classify the scores into A, B, C, D, and F categories. According to the criteria given in Problem Set 1, we can use the following classification: - A: score >= 90 - B: 80 <= score < 90 - C: 70 <= score < 80 - D: 60 <= score < 70 - F: score < 60 Here's the code to classify the scores and count the number of scores in each category: ```python counts = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'F': 0} for score in scores: if score >= 90: counts['A'] += 1 elif score >= 80: counts['B'] += 1 elif score >= 70: counts['C'] += 1 elif score >= 60: counts['D'] += 1 else: counts['F'] += 1 print(counts) ``` This code will create a dictionary `counts` containing the number of scores in each category. Finally, we can use the `plotly` library to create a histogram of the scores. Here's the complete code: ```python import csv import plotly.graph_objs as go scores = [] with open('midterm.csv', newline='') as csvfile: reader = csv.reader(csvfile) next(reader) # skip header row for row in reader: scores.append(int(row[1])) counts = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'F': 0} for score in scores: if score >= 90: counts['A'] += 1 elif score >= 80: counts['B'] += 1 elif score >= 70: counts['C'] += 1 elif score >= 60: counts['D'] += 1 else: counts['F'] += 1 labels = ['A', 'B', 'C', 'D', 'F'] values = [counts[label] for label in labels] fig = go.Figure([go.Bar(x=labels, y=values)]) fig.show() ``` This code will create a histogram of the scores, showing the number of scores in each category.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值