作业六

#第一题:
#fruitList=["梨子","苹果","香蕉","橘子","西瓜","芒果","柚子"]
#fruit_num=len(fruitList)
#print(fruit_num)

#第二题:
#fruit_en_List=["Pear","Apple","Banana","Orange","Watermelon","Mango","Pomelo"]
#fruit_cn_List=["梨子","苹果","香蕉","橘子","西瓜","芒果","柚子"]
#index=0
#while True:
#    fruit_en=fruit_en_List[index]
#    fruit_cn=fruit_cn_List[index]
#    user=input("请输入"+fruit_en+"的中文翻译是:")
#    if user==fruit_cn:
#        print("回答正确")          
#    else:
#        print("回答错误")
#    index=index+1
#    if index==7:
#        break

#第三题:
#lengthList=["毫米(mm)","厘米(cm)","分米(dm)","米(m)","千米(km)"]
#resList=["瓜子","橡皮","桌子","门","公路"]
#while True:
#    name=input("请输入物品的名字:")
#    index=resList.index(name)
#    print(name+"的长度单位是:"+lengthList[index])

#第四题:
#numList=[54,23,45,67,34,90,12,None,35,69,36,57,91,None,42,123,541,122,359,126,231,235,456,789,223,112]
#index=0
#numSun=0
#while True:
#    if numList[index]==None:
#        index=index+1
#        continue
#    if numList[index]%2!=0
#        numSun=numList[index]+numSun
#    if index==len(numList)-1:
#        break
#    index=index+1
#print(numSun)

#第五题:
#numList=[1,2,3,5,79,4,7,24,71,345,132,6756,317865,95,13,72,55,476,77]

#第六题:
#numList=[1,2,3,5,79,4,7,24,71,345,132,6756,31,7865,95,13,72,55,476,77]
#print(numList[0]+numList[13]+numList[16]+numList[19])

#第七题:
#numList=[1,2,3,5,79,4,7,24,71,345,132,6756,31,7865,95,13,72,55,476,77]
#numList[16]=None
#print(numList[0]+numList[13]+numList[16]+numList[19])

#第八题:
#index=0
#while True:
#    if numList[index]==None
#        print(index)
#        break
#    index+=1
#    if index>=len(numList)
#        break

#第九题:
#nameList=["张一","李二","周三","徐四","王五","赵六","吴七"]
#while True:
#    name=input("请输入学生姓名:")
#    print(name+"同学的学号是:"+str(nameList.index(name)))

#第十题:
#nameList=["张一","李二","周三","徐四","王五","赵六","吴七"]
#yuwen=[73,57,87,89,68,88,99]
#while True:
#    num=input("请输入学生学号:")
#    print(nameList[int(num)]+"的语文成绩是:"+str(yuwen[int(num)]))

#第十一题:
#nameList=["张一","李二","周三","徐四","王五","赵六","吴七"]
#yuwen=[73,57,87,89,68,88,99]
#yingyu=[]
#while True:
#    num=input("请输入学生学号:")
#    subject=input(请输入要查询的学科:)
#    if subject=="语文":
#        print(nameList[int(num)]+"的语文成绩是:"+str(yuwen[int(num)]))
#    elif subject=="英语":
#        print(nameList[int(num)]+"的英语成绩是:"+str(yingyu[int(num)]))
#    else:
#        print("你要查询的学科不存在")

#第十二题:
#nameList=["张一","李二","周三","徐四","王五","赵六","吴七"]
#index=nrmeList.index("李二")
#nameList[index]=None
#while True:
#    num=input("请输入学生学号:")
#    if nameList[int(num)]==None:
#        print("该同学的信息不在!")
#    else:
#        print("学号为"+num+"的同学是"+nameList[int(num)])

#第十三题:
#nameList=["张一",None,"周三","徐四","王五","赵六","吴七"]
#nameList[1]="陈八"
#while True:
#    num=int(input("请输入学号:"))
#    if nameList[num]==None:
#        print("查询的同学信息不在!")
#    else:
#        print("拥有学号"+str(num)+"的是"+nameList[num]+"同学")

  

posted @ 2020-02-01 11:05  丁正康  阅读(134)  评论(0)    收藏  举报