Difference between %c and %s

What is the difference between %c and %s in python.
Please explain with example?

c is generally used for a single character while s is used for the string.
Ex:
name = ‘h’
print(“hello %c”%h)
This will print “hello h”

name = ‘h’
print(“hello %s”%h)
This will print “hello h”

name = ‘hm’
print(“hello %c”%h)
This will return an error since name contains a string and not a character.

name = ‘hm’
print(“hello %s”%h)
This will print “hello hm”

Hope this cleared your doubt. :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.