Skip to content

forked the main site so I can upload code for HW#127

Closed
iampei wants to merge 1 commit intoUWPCE-PythonCert:masterfrom
iampei:master
Closed

forked the main site so I can upload code for HW#127
iampei wants to merge 1 commit intoUWPCE-PythonCert:masterfrom
iampei:master

Conversation

@iampei
Copy link

@iampei iampei commented Jan 27, 2016

I uploaded all 3 sessions - simple calculator: added divide by 0 error.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you are raising a ValueError, and not including a message no error will show up on your page. You should either include a message:

 raise ValueError("Please use 'add', 'subtract', 'multiply', or 'divide'")

or catch the ValueError in your application function, and address it there. Also, it shouldn't be a ValueError, but probably a NameError, since these are not numbers.

@codedragon
Copy link

Works, yay! A couple of notes, Cris had asked to include a readme, which is a good habit to get into. Also, it is best to have tests. In a small app like this, it may seem like overkill, but when you start trying to refactor larger code bases, you will be glad to be in the habit of writing tests. Finally, I would think about how you might refactor your app to allow more inputs (2+3+5, for example).

@codedragon codedragon closed this Jan 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants