python间隔切片

字符串'AABCDEFGHHIJ'中如果我要取得ACGJ,并在一行内显示,要怎么切片,怎么print结果
以下是我的代码:
s='AABCDEFGHHIJ'
a=s[1:5:2]
b=s[7:12:4]
template='a{}'
result=template.format(b)
print(result)

上面是我的代码不知道哪里出错

img


如有帮助请采纳谢谢

好像是format这里错了,要格式化两个列表变量的值,用两个{},然后后面把a和b作为参数传递进来,来打印列表a和列表b他们的每个值。
计算机二级python——“{}“.format()函数的详细用法_-•_•-的博客-CSDN博客_{}'.format
Python基础知识:切片_阿伟已经死了!的博客-CSDN博客_python切片

s='AABCDEFGHHIJ'
a=s[1:5:2]
b=s[7:12:4]
#result=[]
#for t in a:
  #  result.append(t)
#for p in b:
  #  result.append(p)
print('a={}{}'.format(a,b))



img