Created
July 27, 2010 04:25
-
-
Save emilepetrone/491740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
print 'Content-Type: text/html' | |
print '' | |
print '<pre>' | |
# Read the form input which is a single line | |
# guess=25 | |
guess = -1 | |
data = sys.stdin.read() | |
#print data | |
try: | |
guess = int(data[data.find( '=' )+1:]) | |
except: | |
guess = -1 | |
print 'Your guess is', guess | |
answer = 42 | |
if guess < answer : | |
print 'Your guess is too low' | |
if guess == answer : | |
print 'Congrats!' | |
if guess > answer : | |
print 'Your guess is too high' | |
print '</pre>' | |
print '''<form method="post" action="/"> | |
Enter Guess: <input type="text" name"guess"><br> | |
<input type="submit"> | |
</form>''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment