Execute HQ9+/Python: Difference between revisions

Content added Content deleted
No edit summary
(added + operator)
Line 1: Line 1:
{{collection|RCHQ9+}}
{{collection|RCHQ9+}}


This example implements only 'H','Q' and '9' because the author did not explained what '+' do.
This example implements 'H', 'Q', '9' and '+'.

The author does not explains what '+' exactly do. I just increased a "acc" variable.


<lang python>import sys
<lang python>import sys
Line 49: Line 51:
sys.exit(1)
sys.exit(1)


acc = 0
src = s.read()
src = s.read()


Line 58: Line 61:
elif i == '9':
elif i == '9':
bottles()
bottles()
elif i == '+':
acc += 1 # ?
else:
else:
pass # Comment...
pass # It's a comment, ignore it.</lang>
</lang>