#!/usr/home/sweetapp/bin/python


import cgitb; cgitb.enable()
from DocXMLRPCServer import DocCGIXMLRPCRequestHandler
import random

secret_number = random.randint(1, 100)

def guess(number):
    
"""guess(50) => -1

    Guess a number in 1-99. Returns -1 if you
    guessed low, 1 if you guessed high and 0
    if you guessed correctly. The number is
    reset on a correct guess."""


    
global secret_number
    
if number == secret_number:
        
secret_number = random.randint(1, 100)        
        
return 0
    
elif number < secret_number:
        
return -1
    
else:
        
return 1

def iguess(number):
    
"""iguess(50) => "Too low!"
    
    Guess a number in 1-99. Returns a string
    indicating if you are too low, too high or
    correct. The number is reset on a correct
    guess."""

    
    
global secret_number
    
if number == secret_number:
        
secret_number = random.randint(1, 100)        
        
return "Correct! Try again!"
    
elif number < secret_number:
        
return "Too low!"
    
else:
        
return "Too high!"

server = DocCGIXMLRPCRequestHandler()
server.register_introspection_functions()
server.register_multicall_functions()
server.register_function(guess)
server.register_function(iguess)
server.handle_request()

Download
The source was styled using SilverCity