CIS 111 Basic I/O

Objectives

  • Prompt the user for input
  • Get input from the user
  • Convert user input into the proper data type
  • Perform simple calculations
  • Display output to the user

Overview

The source code listings for these programs, and all others due in this course, must include comments at the beginning of the source code which contain your name, the course, the date, and the assignment number. Follow style conventions covered in class. Assignments should be submitted to the assignment dropbox in Desire2Learn. You must submit the source code (.py) files. Flowcharts representing the basic algorithms for each program are provided.

Program #1 (of 2)

(15 points) Write a program that displays the following output on the screen. You can print a " within a "-delimited Python string using the character combination: \". Likewise, you can print a ' within a '-delimited Python string using the character combination: \'.

Note: Output was generated by the figlet program using the univers font - but that is not relevant to your completing this assignment.

Sample output:

,ad8888ba, 88 ad88888ba 88 88 88 d8"' `"8b 88 d8" "8b ,d88 ,d88 ,d88 d8' 88 Y8, 888888 888888 888888 88 88 `Y8aaaaa, 88 88 88 88 88 `"""""8b, 88 88 88 Y8, 88 `8b 88 88 88 Y8a. .a8P 88 Y8a a8P 88 88 88 `"Y8888Y"' 88 "Y88888P" 88 88 88

Link to text version of above

Program #2 (of 2)

(25 points) Write a program which gets the number of hours, minutes, and seconds the user was riding their bicycle and the number of miles the user travelled. Then calculate and display the average miles per hour for the user's bicycle trip.

Notes: mph = miles / hours There are 60 seconds in a minutes, so 13 seconds = 13/60 of a minute There are 60 minutes in an hour, so 7 minutes = 7/60 of an hour Sample run: This program calculates your average speed for a bicycle trip Please enter the hours: 3 Please enter the minutes: 12 Please enter the seconds: 50 Please enter the miles: 62.14 Your average speed was 19.334831 MPH

Flowchart for program #1

Flowchart for program 1

Flowchart for program #2

Flowchart for program 2

Rubric

  1. Problem #1 is worth 15 points:
    • 10 points for correct operation (the output must match exactly)
    • 5 points for proper documentation comments and correctly following coding conventions (indentation, naming rules, etc.)
  2. Problem #2 is worth 25 points:
    • 5 points for having a working program (and results must be based upon user input)
    • 5 points for reasonable code for user input (including descriptive prompts)
    • 5 points for reasonable code for the calculations
    • 5 points for reasonable code for the output (your output should match the sample exactly)
    • 5 points for proper documentation comments and for correctly following coding conventions (indentation, naming rules, etc.)