[Tutor] Forms

gordnjen gordnjen at rogers.com
Mon Jul 18 22:22:31 CEST 2005


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050718/1ca60b40/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/1ca60b40/attachment-0001.jpeg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050718/1ca60b40/Secondone-0001.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050718/1ca60b40/Fifthone-0001.html

More information about the Tutor mailing list