python列表中移动的方法有哪些_在python列表中移动项目?

这是最后的产品。如果其他人有什么秘诀,请告诉我!非常感谢你的帮助!在def triple_cut(deck):

''' (list of int) -> NoneType

Modify deck by finding the first joker and putting all the cards above it

to the bottom of deck, and all the cards below the second joker to the top

of deck.

>>> deck = [2, 7, 3, 27, 11, 23, 28, 1, 6, 9, 13, 4]

>>> triple_cut(deck)

>>> deck

[1, 6, 9, 13, 4, 27, 11, 23, 28, 2, 7, 3]

'''

joker1 = deck.index(JOKER1)

joker2 = deck.index(JOKER2)

first = min(joker1, joker2)

first_cards = []

for cards in range(len(deck[:first])):

cards = 0

pop = deck.pop(cards)

first_cards.append(pop)

joker1 = deck.index(JOKER1)

joker2 = deck.index(JOKER2)

second = max(joker1, joker2)

second_cards = []

for cards in deck[second + 1:]:

pop = deck.pop(deck.index(cards))

second_cards.append(pop)

second_cards.reverse()

for card in second_cards:

deck.insert(0, card)

deck.extend(first_cards)

我需要键入更多,因为我的帖子主要是代码:请添加更多细节sss ss

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值