Go Fish/Python: Difference between revisions
m
Fixed syntax highlighting.
No edit summary |
m (Fixed syntax highlighting.) |
||
(One intermediate revision by one other user not shown) | |||
Line 3:
===OOP===
{{works with|Python|2.5}}
<
import sys
from collections import defaultdict
Line 143:
if __name__=="__main__":
game = PlayGoFish()
game.play()</
===Procedural===
{{works with|Python|3.6}}
<syntaxhighlight lang="python">"""
Plays a Go Fish game between a user and computer
following the rules specified at
Line 451:
if asked_card in hand:
return asked_card
print("You don't have that card. Try again!")
Line 502 ⟶ 501:
if __name__ == "__main__":
play()</syntaxhighlight>
|