习题三和习题四怎么弄?

img

习题三

if __name__ == '__main__':
    while True:
        instr = input('请输入一列数,以\',\'分割:')
        inlist = eval(instr)
        if inlist[0] < inlist[-1]:
            tempnumber = inlist[0]
            for i in inlist:
                if tempnumber > i:
                    break
            else:
                print("这列数手是升序排列的")
        else:
            tempnumber = inlist[0]
            for i in inlist:
                if tempnumber < i:
                    break
            else:
                print("这列数手是降序排列的")

img

???