[Tutor] FW: Forms

gordnjen gordnjen at rogers.com
Tue Jul 19 01:53:25 CEST 2005

Apparently, my last post was interpreted by some as "please do this
assignment for me". By no means do I want this. What I would like, is for
someone to look at my attached files and see if there is anything glaring
they can see where I am going wrong. The error message that I get when I
input values into the first page and click "Go" reads as follows:
Script Error

There was an error with your script and it didn't exit properly.

This was its output:

  File "/home/jgates/public_html/Fifthone.py", line 12

    print form int(["red1"].value),"%"


SyntaxError: invalid syntax
The instructions I listed below were put there so that you could understand
what exactly I was trying to do with these pages.
Any help you could provide would be much appreciated.
If you think I am out of line in asking the above, just ignore this post and
I will get the drift.
But any help would be a godsend!!!

-----Original Message-----
From: gordnjen [mailto:gordnjen at rogers.com] 
Sent: July 18, 2005 4:23 PM
To: 'tutor at python.org'
Subject: Forms


This is my latest assignment:

For this assignment, you will create a web script that lets the user explore
RGB colours.

On the first page the user sees, they should specify two RGB colours.  When
they submit this page, they should be presented with a range of colours in
between the two.
The intermediate colours will be calculated by your program.

For example, if the user enters the colours red (100% red, 0% green, 0%
blue) and white (100% red, 100% green, 100% blue), your program might output
a page containing this:

Your program must never output more than 150 total colours, no matter how
many the user asks for.  If the users asks for more, it should only output



You have to be careful about the spacing when outputting the RGB percentage
values.  You will have to convert the numbers to strings and concatenate
them.  For example, this statement will output part of the style attribute:

        print 'style="background-color: rgb(' + str(r) + '%'

     All of your XHTML (including generated XHTML) and CSS must be valid.


 1. Create the query page that asks the user for the colours they want to

   2. Create a web script that converts the values the user entered to
integers, stores them in variables, and outputs them. 

   3. Modify the web script so it counts from 0 up to the number of steps
they requested minus 1.  So, if they ask for 5 steps, it outputs "0 1 2 3

   4. Modify the web script so it calculates and outputs the percentages of
red for each step.  Check these and make sure they're right: they start and
end at the values specified by the user; there are the right number of
steps; the steps are separated by the same amount. 

   5. Add in the calculation of the green and blue values and check those.

   6. Use the calculated percentages to output the <div>s and make sure the
colours look right.  Make sure the generated XHTML is valid. 

   7. Add the checking for more than 150 steps. 

I have attached the two files I have so far for this.

Please have a look and advise.






No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.0/50 - Release Date: 16/07/2005

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.0/50 - Release Date: 16/07/2005
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050718/366c9461/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/20050718/366c9461/attachment-0001.jpeg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050718/366c9461/Secondone-0001.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050718/366c9461/Fifthone-0001.html

More information about the Tutor mailing list