Description
Assignment 3
“Looping, Searching, and Slicing”
Background:
Part 1 of this assignment requires that you receive input from the user. This means that you need to utilize the input(…) function. By supplying a string literal to the input(…) function, you can prompt the user so that they understand that they are supposed to input a number, or ‘done’.
Part 2 of this assignment requires that you process a string variable in your code named avg_str. Note that there is no mention of a user in the description of Part
2. In Part 2 of this assignment, there is no user!
Description:
1. Write a program called “process_numbers.py” that repeatedly reads numbers input by the user until the user types “done”. After the user has entered “done”, print out (i.e. print) the total, count, maximum, minimum, and average of the entered numbers. Note that you are not allowed to use a list for this assignment. Lists are not covered until Chapter 8 of our textbook.
2. Given the following python statement…
avg_str = ‘Average value read: 0.72903’
Save your code in a file named “parse_float.py”.
3. Read the Python document on string methods at this URL:
https://docs.python.org/3.5/library/stdtypes.html#string-methods
Spend some time playing with some of these methods. Note that the brackets ([]) in the documentation denote that the bracketed elements are optional.
Deliverable:
Two Python .py files, named “process_numbers.py” and “parse_float.py” respectively, submitted as attachments at our course shell assignment page. Please ensure that your full name is specified at the top of each file within a Python comment.
Please see the course schedule in our syllabus for all assignment submission deadlines.
Peerwise Reminder:
Do you know where your multiple choice Peerwise questions are? Are you letting 10 easy course points slip away?
Reviews
There are no reviews yet.