For some reason i get a syntax error at the input near the end whenever trying to run this: http://pastebin.com/2VR4Jdf2
It worked 5 minutes ago but now it won't even start running.
Which makes no sense by the way because the supposed "error" is at the bottom of the file and python is interpreted!
Name:
Anonymous2012-07-16 3:44
1. use .py extensions
2. #!/usr/bin/env python
Name:
Anonymous2012-07-16 3:54
>>2
1)I am using .py extentions
2)that did absolutely nothing.
File "airwar.py", line 71
choice=input('Play again?\n')
^
SyntaxError: invalid syntax
It says it right there.. it is not expecting that sort of statement. So if you look, your line 71 is INSIDE the paren opened on line 69. dealto(ehand, edeck, len(ehand) dealto(ehand, edeck, len(ehand))
print '\nYour opponent\'s hand is:'
for card in hand:
print display(card)
print "\nYour hand is:"
for card in ehand:
print display(card)
#choose order
#pass
#battle
dlist=deque()
edlist=deque()
for i in range(5):
print '\ncard:%r ecard:%r'\
%(display(hand[i]), display(ehand[i]))
if ehand[i][1]>hand[i][1]:
dlist.append(hand[i])
print 'deleted card:%r'%(display(hand[i]))
elif hand[i][1]>ehand[i][1]:
edlist.append(ehand[i])
print 'deleted ecard:%r'%(display(ehand[i]))
elif hand[i][1]==ehand[i][1]:
pass
if dlist:
for card in dlist:
print '\ncard:%r'%(display(card))
hand.remove(card)
if edlist:
for ecard in edlist:
print '\necard: %r'%(display(ecard))
ehand.remove(ecard)
#ready for next turn
if hand:
dealto(hand, deck, len(hand))
if ehand:
dealto(ehand, edeck, len(ehand)
choice=input('Play again?\n')
if choice[0]=='y' or choice[0]=='Y':
pass
else:
break
deck.py
from collections import deque
def filldeck(deck):
for i in range(52):
deck.append(((i/13)+1, (i%13)+1))
return deck
>>15
Sorry, you want /prog to start posting example code threads? Though, if you want interesting snippets of good code then I suggest you start browsing the threads from ~2007 when this board could still produce mind-fucking LITHPu and decent C.