0
Any suggestions?
https://code.sololearn.com/cAWv7ZAzrisc/#py I'm trying to make a calculator that can handle tax and decimals. I have pretty much everything figured out. However, on the last line I can't seem to round it without breaking something. That being said, I don't really even need the final result (change) to be rounded. Is there a way to cut numbers off to where only 2 decimals are displayed?
7 Antworten
+ 1
print(f'... is the begin of a "simple" formated print statement for python.
inside the {} stand the variable to print. And after the colon var:. 2f is the format.
In this case: print variable var with 2 decimals as float. That's all 😉
+ 1
This one displays 2 decimals rounded:
https://code.sololearn.com/cTpIevROZt7J/?ref=app
+ 1
Imma have to write down that answer cause brain had an error. But for some reason having a -.01 corrects some kind of rounding issue. Idk why. But tyvm for the advice!
0
Awwww
You mean I could have just typed that? xD
In my defense I have no idea what that is suppose to do. Im still at object orientated programming in python stuff here. What exactly is f? and why the {}?
0
Is not clear?
Here is your code with change in line 44
But I'm not sure, if you need the +0.01
https://code.sololearn.com/csXaE7nrB5C0/?ref=app
0
I can see what you did. But why the {}. And im unsure what f' is suppose to do. Im not trying to be difficult.
0
You're welcome