CPSC120
Fundamentals of Computer Science

In-class Activity 3

If you did not finish the activity from the last class to set up directories in your home directory, please do that now. Once you have done that, use the terminal to add a directory to your activities directory called activity3. All of the code you write today should go in this directory.

  1. 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.

  2. How Many Handshakes

    In Emacs, create a Python program in a file called handshakes.py. The program should print how many handshakes it would take for every student at Roanoke to shake hands with every other student at Roanoke. Assume the number of students at Roanoke is 1,869. The program should use Python's arithmetic operations to perform the calculations and should print the number of handshakes nicely formatted and labeled.