Tutorial: Developing a simple calculator with basic command in python(fix bugs in your code)
Repository: CPython
Objective : The objective of this tutorial is to develop a simple calculator using cpython. This would involve the code and certain common bugs that you could encounter with how to identify and fix them.
Note: This tutorial is for someone with a basic knowledge of python.
Software: Download here
(Find a version compatible with your system)
Code
Tutorial
First things first you describe your code using the multiple line comment as seen at the beginning of the code.
Then you define the functions add, subtract, multiply and divide seen in these lines of code.
In the next part of this code involves collecting variables and running these variables in the code. For this we use the if, elif and else function.
Common bugs encountered
It is common to encounter a few bugs when you learn python with versions 2. and move to 3. programs such as cpython. One of these that can be seen in this code is the print function
Another important thing to note is that the values collected have to be floated(i.e in decimal value) hence use the float function to change all input values to floats.
Conclusion
CPython is by far the best version of python I've coded with and it's easy and understandable. Run this program and leave your comments in the comment section.
I thank you for your contribution. Here is my thought;
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
This tutorial was targeted for those starting up on the steemit platform who know the basic concepts but don't know how to apply them. However thanks for your thought.
Hello! I find your post valuable for the wafrica community! Thanks for the great post! @wafrica is now following you! ALWAYs follow @wafrica and use the wafrica tag!