Python Coding Challenge series-1
Welcome to the python coding challenge series-1
- Create a python math application with only 10 lines of code - don't use comments!
Share your link of the repl in comments -
Recieved repls -
The best one would be the winner of this series!
10 upvotes for announcing the winner!
str() is an in built Python function that attempts to convert its argument to string type. In this case, I use it because I am concatenating the result to another string as the output, and because coercion does not exist in python, if I try to do
[string] + [integer] it will raise an exception (error). So I need to convert the integer to a string before I concatenate them.
@CaptinNeo Even better question! I do that to round the result of the calculation. The second
int() encloses the
input() and the first encloses the whole calculation. If I didn't do that, any whole number outputs would come out as
[integer].0 which I didn't want, so I took the route of rounding all of them.