Time for Some Pears Programming

picture of pears

This is a project that will be done in pairs (with one group of three). You will be assigned a group by the feared program mateFools.py.


#!/usr/bin/env python
from sys import argv
import random
with open(argv[1], "r") as fp:
    roster = fp.readlines()
    random.shuffle(roster)
    roster = [k.strip() for k in roster]
with open("fools.html", "w") as fp :
    fp.write("<table class=\"center-table\">\n")
    fp.write("<tr><th>Partner I</th><th>Partner II</th></tr>\n")
    n = len(roster)
    for k in range(0, 2*(n//2), 2):
        fp.write("<tr><td>%s</td><td>%s</td></tr>\n" %(roster[k], roster[k + 1]))
    fp.write("</table>\n")
    if len(roster) % 2 != 0:
        odd_man_out = roster[- 1]
        fp.write("odd man out:  " + odd_man_out + "\n")
        fp.write("random row: %s\n"% (1 + random.choice(range(0, (n//2)))))

Here are the results of runing the program (done live in class).

Partner IPartner IIPartner III
lam22cali23z
pasulka22cwilliams23k
gao23mkey23a
ramanujam23aballentine23c
ganji23jquiett23v
huo22jarora22a
dodoo23jkoya23m
sangangbayan23bwinner22i
le22lmadarapu23vfrench23d

            --------------------------------------------------------------------
            |                       Simple Calculator                          |
            |                                                                  |
            |           ------------------------------------------             |
            |           |                                        |             |
            |           |                                        |             |
            |           -----------------------------------------              |
            |                                                                  |
            |                ------------------                                |
            |   Operand 1:   |                |                                |
            |                -----------------                                 |
            |                                                                  |
            |                ------------------                                |
            |   Operand 2:   |                |                                |
            |                -----------------                                 |
            |                                                                  |
            |                                                                  |
            |   -----    -----    ------    -----      -----                   |
            |   | + |    | - |    |  * |    | / |      |** |                   |
            |   -----    -----    ------    -----      -----                   |
            |                                                                  |
            |                                                                  |
            |                                                                  |
            --------------------------------------------------------------------


You will need to combine your knoledge of CSS, JavaScript and HTML to make this app work and to make it look cool.

Tip Use one computer to do the coding. Use the other to do any scrounging around for information. You might want to agree on the some aspects of the appearance of this app; creating a drawing and choosing some details before you start coding is a smart idea.

A Samll Freebie You can dowload the three files at the left to save typing and linking of the stylesheet and the JavaScript.

A user will enter numbers into the two operand spots. Then, the user hits a button and tne result is displayed in the canvas at the top.

You are encouraged to make use of styles and colors to make your Simple Calculator look cool.

If you wish, you can add other features to this basic calculator.