CPSC120A
Fundamentals of Computer Science I

Lab 2

Values and Expressions

Use the command line to create a new directory called lab2 in your labs directory. Make sure all of the .py files that you create for this activity are in that directory.

Age in Seconds

In Emacs, create a Python program in a file called age_in_seconds.py. The program should print your age in seconds. Assume that there are 365 days in all years. You don't need to compute your exact age, just convert your age in years to seconds. The program should use Python's arithmetic operations to perform the calculations and should print the number of seconds nicely formatted and labeled. For example, the ouput should look something like:

My age, 33 years, is 1072224000 seconds.

World's Tallest Person

The height of the tallest person in recorded history is 107 inches. In Emacs, create a Python program in a file called tallest_person.py. The program should print the height of the tallest person in recorded history in feet and inches. Note, the number of inches should be less than 12. The program should use Python's arithmetic operations to perform calculations and should print the feet and inches nicely formatted and labeled.

Classmates

In Emacs create a python program in a file called classmates.py. The program should print something like the following:

Name        Hometown    Intended Major      Age
====        ========    ==============      ===
Sally       Roanoke     Computer Science    18
Alexander   Washington  Math                19

The average age is 18.5 years.

Except the lines with Sally and Alexander's information should be replaced with your and your lab partner's information. Also add two more lines with information about two classmates sitting near you. The program should not use spaces to align columns. Instead use the tab character, "\t".

The program should also print the average age of the four people. The output should be nicely formatted in a sentence that is all one line. The program should compute the average age using the Python addition and multiplication operators. When you test your program, be sure to verify that the calculation is correct.

Submission

Please show your source code and run your programs for the instructor or lab assistant. Only a programs that have perfect style and flawless functionality will be accepted as complete.