• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • Ruby
  • About
You are here: Home / Python / Using Python to Print Degree Symbol

Using Python to Print Degree Symbol

June 5, 2022 Leave a Comment

In Python, to print the degree symbol, you can use the unicode for the degree sign ‘\u00B0’.

print('\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.

print('\u00B0')  

°

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.

Other Articles You'll Also Like:

  • 1.  Using Python to Check if String Contains Only Letters
  • 2.  How to Remove Vowels from a String in Python
  • 3.  Using Python to Remove Non-Empty Directory
  • 4.  How Clear a Set and Remove All Items in Python
  • 5.  Using Python to Read File Word by Word
  • 6.  Using Python to Calculate Sum of List of Numbers
  • 7.  Count Values by Key in Python Dictionary
  • 8.  Drop Duplicates pandas – Remove Duplicate Rows in DataFrame
  • 9.  Remove Substring from String in Python with replace()
  • 10.  Using if in Python Lambda Expression

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2023 · The Programming Expert · About · Privacy Policy