第一行输入一串数字
第二行输入二个整数,把上面的列表分割成三段(三个列表)
如:
输入 1 2 3 4 5 6 7 8 9
4 7
输出 1 2 3
4 5 6 7
8 9
n=list(map(int,input().split()))
x,y=map(int,input().split())
a1=n[:x-1]
a2=n[x-1:y]
a3=n[y:]
print(a1)
print(a2)
print(a3)
www.xxszxw.net
第一行输入一串数字
第二行输入二个整数,把上面的列表分割成三段(三个列表)
如:
输入 1 2 3 4 5 6 7 8 9
4 7
输出 1 2 3
4 5 6 7
8 9
n=list(map(int,input().split()))
x,y=map(int,input().split())
a1=n[:x-1]
a2=n[x-1:y]
a3=n[y:]
print(a1)
print(a2)
print(a3)