Spring 2015»CSCI 220 Homework 1

CSCI 220 Homework 1

Assigned Date: Monday, Jan. 26, 2015
Due Date: Friday, Jan. 30, 2015
Due Time: 12:20pm

Last modified on May 12, 2016, at 11:40 AM (see updates)

Purpose

This assignment focuses on:

  1. Be able to edit and run a Python program using the JEM or IDLE integrated development environment (IDE).
  2. Interact with simple Python programs that produce output and do arithmetic.

Assignment

Write a program that converts temperatures from Fahrenheit to Celsius.

Note

Make sure your program is user-friendly, i.e., that it provides a meaningful input prompt and output message.

Bonus

Check the user input to ensure that it is an int or a float before making the conversion. If the user makes an error, output a meaningful error and terminate. If the input is correct, perform the conversion and output the result.

If you do the bonus, make sure you update the header documentation below to reflect that.

Documentation

In general, you should comment any variable, obscure statement, block of code, etc. you create.

Additionally, your code should always have header documentation that explains what the program does, in general terms.

For this assignment, just copy and paste these into the top of your program. (For future assignments, you will have to modify these comments, to fit the new assignment.)

# FahrenheitToCelsius.py
#
# Author:     <Your name>
# Email:      <Your email address>
# Class:      CSCI 220
# Assignment: Homework #1
# Due Date:   <The assignment's due date>
#
# Purpose: This program converts degrees Fahrenheit to degrees Celsius.
#
# Input:     The degrees in Fahrenheit.  No error checking is performed
#               (i.e., we assume the user makes no mistake when entering these values).
#
# Output:  The corresponding degrees in Celsius.     
#
 

NOTE: In the above, replace the bracketed phrases, e.g., , with your name, e.g., John Smith. Do remove the brackets.

Submissions

You will submit your assignment via OAKS. Your submission consists of:

  1. Your Python program. Call it, FahrenheitToCelsius.py.
  2. A printout of your program - to be submitted in class on the due date.
  3. If you do the bonus, submit a separate, additional program. Give this program a different name, i.e., FahrenheitToCelsius.bonus.py

Grading

Your grade will be based on how well you followed the above instructions.