Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (1.5k points)
Can anybody please tell me  what is the use of % operator in the print statement.

1 Answer

0 votes
by (1.4k points)

The % operator in Python for strings is used for String substitution. 

This is often referred to as the string formatting or interpolation operator 

  

Example: 

def greet(name): 

    print('Hello, %s!'%name) 

Related questions

0 votes
1 answer
asked Feb 15, 2021 in Python by adhiraj (4k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...