-2

Can someone explain to me what %.1f means?

Example:

v_alt = vehicle.location.global_relative_frame.alt 

print("Value: %.1f meters" %v_alt)
Ryan
  • 1
  • 1

1 Answers1

2

It means the floating point number will be printed with one number behind the comma

>>> x = 12.34567
>>> print('Value is %.1f' % x)
Value is 12.3
xjcl
  • 12,848
  • 6
  • 67
  • 89