Sep-04-2017, 07:00 AM
(Sep-01-2017, 02:31 PM)hbknjr Wrote:(Aug-30-2017, 08:59 AM)Crackity Wrote: I was wondering though if there is a certain situation[s] where one option is preferred over the other?"{}".format(arg)
is for formatting string and printing them. You'll receive a string when using it
whereasround(number,ndigits)
is used to round off, it returns float which can further be used for calculations.
Ahh, that explains it! I almost posted it here but thought better of it, but after I finished the tip calculator and moved on to the next project I attempted to make use of both examples to verify that it worked the way I thought it would... and it didn't!
However your explanation... explains it!

On my next project I was supposed to have some user input and some set data, (non iterable???

Sorry just went back and double checked and thought I understood, but now am confused again. If I enter for example:
prep = 1000.00
does Python see that as a string or is it automatically defined as an integer or floating point due to the " . "?
If it still sees it as a string then mystery solved, but if it's already an integer by default then I don't know why the "round" option didn't work for me.
Either way I started this response to say thank you for all of your assistance!
And to Dead_EyE? Vielen Dank for deine hilfe mein freunde.
before you get excited, Ich spreche nur ein bissien Deutche.

Quote:If you can't learn to do something well?... Learn to enjoy doing it poorly.