[Tutor] Doctype declaration

gordnjen gordnjen at rogers.com
Thu Jul 7 02:54:27 CEST 2005

Thanks to everyone who helped me with the problem I had with my "age"
program. I now have it working properly (yay).
So, now I need to know how to insert a doctype declaration into my python
script so that a) the python script runs properly and b)the page validates
as valid XHTML.
Here is my code below. It runs fine as a python script, but won't validate:
import time
print "Content-type: text/html"
print "<html><head>"
print "<title>Current Time</title>"
print "</head><body>"
print "<h1><b>Current Time</b></h1>"
print "<p>The current time is"
print "<strong>", time.asctime(), "</strong></p>"
print "</body></html>"

Any help would be greatly appreciated!
-----Original Message-----
From: gordnjen [mailto:gordnjen at rogers.com] 
Sent: July 4, 2005 10:25 PM
To: 'tutor at python.org'
Subject: "And" function

I need to write a program that will do the following:
Ask the user's age.
If their age is below 1 yr old, it prints "you are old enought to eat baby
If they are over 16, it prints "You are old enough to drive"
If they are over 65, it prints "You are old enough to drive" and "You are
old enough to retire"
If they are between the ages of 16 and 25, it prints "you are old enough to
get a student discount".
So far, I have this:
age =int(raw_input("How old are you?"))
if age>16:
    print "You are old enough to drive!"
    if age>65:
        print "You are old enough to retire!"
        if age<1:
            print "You are old enough to eat baby food!"
I get stuck with the old enough to get a student discount part. I have tried
if age>16 and age<25:
print "You are old enough to get a student discount"
But it doesn't seem to work.
Any help would be great.


No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.9/41 - Release Date: 05/07/2005
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050706/7b3dcbe4/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 17147 bytes
Desc: not available
Url : http://mail.python.org/pipermail/tutor/attachments/20050706/7b3dcbe4/attachment-0001.jpeg

More information about the Tutor mailing list