How to print percentage sign(‘%’) in Python

In this tutorial, we will learn how to print a percentage sign (‘%’) in Python.

‘%’ sign also denotes modulo operator (a%b) which returns the remainder as
when ‘a’ is divided by ‘b’.
Also, ‘%’ is an ASCII symbol which has an ASCII value of  ’37’
Now let us code our solution.

Print percentage sign in Python

The first method is to store the symbol in string format and then
use the print function to print as shown in the below.

var = "%"

The other method is through the ascii value of the symbol
Let us find out the ascii value of the symbol

var = ord('%')
print("The ascii value of % is " + var)
# ASCII value for any charater is found using ord() function 
# which has got argument of type "string" and return type is INTEGER


The ascii value of % is 37

#chr() is a in-built function in python which is used to convert

#ascii values to their respective symbols or characters

ASCII value 37 denotes ‘%’ symbol



Hope this tutorial helps you to learn how to print percentage “%” symbol in Python.

You may also read:

3 responses to “How to print percentage sign(‘%’) in Python”

  1. Purnendu says:

    I think there is no need for those steps.
    We can print it simply on python3.

    user_input = input(‘Enter string : ‘)

    Enter string : myinput

    • Saruque Ahamed Mollick says:

      Thanks, Purnendu. Yes, it was a simple problem. In Python 3 it is as simple as we print other characters and symbol. I hope the procedure he applied might help in some other programming languages.

  2. Uddeshya Mishra says:

    Hey, Purnendu. I think thats what the first method is i.e converting the symbol into string and then printing it and thanks to suggest a method but I don’t think to take an input just to print a symbol.

Leave a Reply