How do I write a string in Python?
What is a string: A string is a sequence of characters. If you want to create a string in python, put or write the sequence of characters in single quotes (‘ ’), Double quotes(“ ”), or triple quotes(“”” “””). The string is surrounded by either single quotes, double quotes, or triple quotes.
Write a string in python:
You can simply write a string in the print function that means
Print(‘Hello world’)
print(“Hello world”)
print(“””Hello world”””)
How to assign a string to a variable:
Firstly, take a variable and assign a string to that variable.
a = “Hello world”
print(a)
I hope it helps you.
Comments
Post a Comment