Assignment 7: Error Handling & Pickling

Vid Chari
8/31/2019
Assignment 7: Error Handling & Pickling
GitHub: https://github.com/vidhurchari/IntroToProg-Python

Assignment 7: Error Handling & Pickling 

Introduction

The goal of this assignment is to get introduced to error handling and pickling. The input here is the user’s choice of numbers. In this assignment, I had to identify and highlight exceptions in both the inputs and some of the operations as well as pickling the variables that I wanted saved in the file.

The script








As described in the comments above, the script has the following steps – gathering inputs from the user, error checking them, performing the math operations and error handling those calculations as needed, pickling the data and passing it into a text file in its pickled format, reading the pickled values, unpickling them and displaying them back to the user

Sample Output


In the sample output, I have intentionally run the program twice in PyCharm as well as the command module to show it works in both and that the inputs go into the .txt file irrespective of where it is run from.

Summary 

The assignment does a good job testing our ability to understand error handling and pickling. The script above does a good job of error testing, performing calculations and pickling values it saves to the .txt file. The pickling doesn’t seem to work all to well with the strings though, as instances of the name can be seen in the .txt file.

Comments