Your technology certification is waiting. Enroll in Cloud Class ®
from math import pi
num_digits = 5
print("%.*f" % (num_digits, pi))
Open in new window
num_digits = 8
a_seventh = 1.0 / 7
print("%.*f" % (num_digits, a_seventh))
format_string % formatarguments
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.