Learn the basic syntax of Python with practical examples to print text, numbers, and strings using the print()
function.
The basic syntax for printing "Hello World" in Python uses the print() function.
print("Hello World")Output
Hello WorldPrinting a Number
To print a number in Python, simply use the print() function.
print(6)Output
6Strings
A string in Python is enclosed in either double quotes (" ") or single quotes (' '). Strings can contain any character, including special characters.
x = "Small Code" print(x)Output
Small Code