I’m trying to print out a float number, that has the value 5
What I get when it print it out is 5.0, so my question is:
How to i make it so, that if the value is just 5, it will just print 5 without the .0 after it, and if it is 5.2 or so, it will print out that?
I’ve looked around, but all I found was to either force it one way or another.
Can someone help me in the right direction? Thanks 🙂
Try this:
This will even work for
number = "5.30" # => '5.3'.