本文整理汇总了Python中Deck.Deck.sort方法的典型用法代码示例。如果您正苦于以下问题:Python Deck.sort方法的具体用法?Python Deck.sort怎么用?Python Deck.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck.Deck
的用法示例。
在下文中一共展示了Deck.sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from Deck import Deck [as 别名]
# 或者: from Deck.Deck import sort [as 别名]
print(d)
print('The length of this deck is', len(d.cards))
print('\nAnd the other property is d.next =', str(d.next))
print()
## Testing the Shuffle method.
print('\n#<====== Shuffling Deck ======>#\n')
d.shuffle()
print('The shuffle method will return the deck as:\n')
print(d, '\n')
## Testing the sort method.
print('\n#<====== Sorting Deck ======>#\n')
d.sort()
print('The sort method will return the deck as:\n')
print(d, '\n')
## Testing the Deal method.
print('\n#<====== Dealing Deck ======>#\n')
print('Card #1 is', d.deal())
print('Card #2 is', d.deal())
print('\nThe number of cards left in the deck:', len(d.cards))
print()
def battle():
print('\n#<====== Playing a Game of War ======>#\n')
## Creating p1Score, p2Score, ties variables.
p1Score = 0