In Python, to print the degree symbol, you can use the unicode for the degree sign ‘\u00B0’.
When outputting text to the console or to a file, the ability to write different symbols easily is valuable.
One such symbol which is commonly used is the degree symbol. Degrees are used in different areas of science and math, such as weather or trigonometry.
Python has the ability to write many symbols and emojis since many symbols have a unicode associated with it.
To print the degree sign symbol, you can use the unicode for degrees ‘\u00B0’.
Below shows how you can print the degree symbol in Python.
If you are working with degrees and numbers representing degrees, you can use the following code to print degrees to the console with Python.
def format_degrees(deg): return str(deg) + '\u00B0' print(format_degrees(100)) #Output: 100°
Hopefully this article has been useful for you to learn how to print the degree symbol with Python.
Leave a Reply