python八个评委打分
时间: 2023-10-05 13:10:27 浏览: 143
评委打分系统
根据引用和引用的内容,可以编写一个Python程序来模拟八个评委对歌手打分的情况。以下是示例代码:
```python
if __name__ == '__main__':
print("八个评委打分程序")
print("=======================")
score_str = input("请输入8名评委的打分,用英文逗号间隔分数: \n")
temp_score_list = score_str.split(",")
score_list = list(map(float, temp_score_list))
max_score = max(score_list)
min_score = min(score_list)
score_list.remove(min_score)
score_list.remove(max_score)
average_score = sum(score_list) / len(score_list)
print(f"去掉一个最低分: {min_score}")
print(f"去掉一个最高分: {max_score}")
print(f"该歌手的有效打分为: {score_list}")
print(f"该歌手的平均分为: {average_score:.2f}")
```
以上代码中,我们首先要求用户输入八个评委的打分,然后根据输入的分数计算出去掉一个最高分和一个最低分后的有效打分,最后计算平均分并输出结果。
希望这个回答能够帮到你!<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [用几行Python代码模拟评委打分](https://blog.csdn.net/xff123456_/article/details/123743282)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [【Python习题】评委打分](https://blog.csdn.net/qq_42910355/article/details/127641456)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Python爬虫解析笔记.md](https://download.csdn.net/download/weixin_52057528/88258586)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文