Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

print number upto 2 decimal places in f string python

variable = 77.05750066143399
# Print variable upto 2 decimal places using f-string
print(f"Variable upto 2 decimal places : {variable:.2f}")
################# Output #################
Variable upto 2 decimal places : 77.06
##########################################

# don't forget to upvote :)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #number #upto #decimal #places #string #python
ADD COMMENT
Topic
Name
4+8 =