From 2bc8ad85c47dcc3615d7ec8b6bbcdc25992ce7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=BB=B7=E5=A5=87?= <1148765366@qq.com> Date: Mon, 29 Mar 2021 21:43:30 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E4=BD=9C=E4=B8=9A3.py.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "\344\275\234\344\270\2323.py" | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 "\344\275\234\344\270\2323.py" diff --git "a/\344\275\234\344\270\2323.py" "b/\344\275\234\344\270\2323.py" new file mode 100644 index 0000000..f0e3a13 --- /dev/null +++ "b/\344\275\234\344\270\2323.py" @@ -0,0 +1,29 @@ +# -*- coding:utf-8 -*- +""" +作者:刘廷奇 +文件:作业3.py +时间:2021年03月29日 +""" + +CaoWei = ["荀彧", "荀攸", "贾诩", "郭嘉", "程昱"] +ShuHan = ["简雍", "糜竺", "糜芳", "庞统", "法正"] +SunWu = ["张昭", "张紘", "鲁肃", "虞翻", "顾雍"] +print("现有各阵营人物: ", "\n曹魏:", CaoWei, "\n蜀汉:", ShuHan, "\n孙吴:", SunWu) +CaoWei.append("陈群") +print("为曹魏阵营增加”陈群“,更新后的曹魏阵营:\n", CaoWei) +del CaoWei[0] +print("为曹魏阵营裁掉”荀彧“,更新后的曹魏阵营:\n", CaoWei) +LianJun = ShuHan + SunWu +print("蜀汉孙吴联军阵营:\n", LianJun) +LianJun = LianJun[::2] +print("裁军保证阵营人数相同,新的联军阵营为:\n", LianJun) +L = C = 0 +for item in range(0, 5): + if LianJun[item] > CaoWei[item]: + L += 1 + pass + elif LianJun[item] < CaoWei[item]: + C += 1 +print("两军作战胜场:曹魏:", C, " 联军:", L) +CaoWei.sort() +print("曹军作战能力:", CaoWei) -- Gitee