Back to Problem Solutions forum
Hi i am trying to solve Dynamic Web Page problem but when i load the web page on my browser it prints my code instead of giving me the solution can u please help me this is my solution:
#!/usr/bin/env python
import random
print "Content-Type: text/plain"
print
def randomize():
num=random.randint(10000,99999999)
while num%1250!=0:
num=random.randint(10000,99999999)
return num
print "Random value is " + str(randomize());
thanks for helping
Hi! Could you please tell, where you store your page - i.e. where from you load it with your browser?
http://mazein1978.pythonanywhere.com/codeabbey/solution.py
Ah, I see.
I'm afraid this could not work. PythonAnywhere requires you to use more modern (and bit more complicated) WSGI interface instead of old CGI. However if you want you can read these instructions and I believe you'll be able to make necessary changes in few minutes.
If you prefer to use CGI-style code, you need to use simple hosting (like CgiWebHost).
Have just solved it . Thanks for the supporting and the instructions were more than helpful :) .