xxxxxxxxxx
number_dec = str(number-int(number))[1:]
xxxxxxxxxx
#larryadah
# This is my favorite option
num = 987.654321
rounded_num = round(num, 2) # to 2 decimal places
print(rounded_num) # rounded_num = 987.65
print(type(rouned_num)) # the rounded value remains a 'float'
# However, a second option could be
num = 987.654321
rounded_num = '{0:.2f}'.format(num) # to 2 decimal places
print(rounded_num) # rounded_num = '987.65'
print(type(rouned_num)) # the rounded value becomes a 'string'
#larryadah
xxxxxxxxxx
express 'rewrite' the number 3.1416 to two significant figures.
express rewrite the number 8.998 to two significant figures.