美文网首页
Python作业3

Python作业3

作者: 蜗牛也有梦想 | 来源:发表于2017-11-22 15:43 被阅读4次

    第一题

    def getArr(arr1,arr2):
    boolValue = False
    arr = []
    boolValue = False
    for i in arr1:
    for j in arr2:
    if i == j:
    boolValue = True
    if boolValue == False:
    arr.append(i)
    boolValue = False
    return arr

    mathArr=["长山","小玉","花轮","永泽","小丸子"]
    enArr=["永泽","花轮","丸尾","野口","美環"]
    print(getArr(mathArr,enArr))
    print(getArr(enArr,mathArr))

    第二题

    arr=[1,2,3,4,5,6,7,8,9,10]
    folder=[]
    for i in arr:
    folder.append(arr[-1]-i+1)
    print(folder)
    for i in range(1,11):
    print (folder.pop())

    第三题

    string = "The Beatles split up in April 1970"
    arr = string.split()
    print (arr[2])

    相关文章

      网友评论

          本文标题:Python作业3

          本文链接:https://www.haomeiwen.com/subject/hlgrvxtx.html