bembry.org
Home / Technology / Python / Exercises

Python Lesson 4 Exercises: User Interface: Looking Pretty

Write each script described below. Save each script in your folder as "pa4-1", "pa4-2", and so forth. Run the script to make sure it works. Remember to include comments that contain your name and a description of the script you have written in the first two lines of code. Exercise 1:
A few years ago there was a rather popular, fairly expensive program that claimed to do great things for your computer. In reality, the program did absolutely nothing to the computer, it only made the user feel better. Write a "bogus" program that purports to be "tuning" the user's system in some way, but in reality does absolutely nothing.

Exercise 2:
You have been asked to assist in tallying the votes for the two candidates in the school-wide student council election. There are five classes that will be voting in this election. Write a program that will allow the user to enter the name of the two candidates, how many votes each candidate received from each class, and will then print out a chart showing how the classes voted and the total tally received for each candidate. The chart should look something like the following:

            Class 1  |  Class 2  |  Class 3 |  Class 4 |  Class 5  |  Total
    -----------------|-----------|----------|----------|-----------|----------
A. Winner       12   |    14     |    20    |    15    |    12     |    73
A.  Whiner       5   |     7     |     1    |     4    |     9     |    26
 

Lesson Exercises Python Lessons Homepage

Restricted access