Today we are going to see python print statement usage.
Print is used to print the output in the console.
print("Hello, World!") # Output: Hello, World!
print(123) # Output: 123
print(3.14) # Output: 3.14
print("The answer is", 42) # Output: The answer is 42
name = "Alice"
age = 30
print(f"My name is {name} and I am {age} years old.") # Output: My name is Alice and I am 30 years old.
print("Python", "is", "fun", sep="-") # Output: Python-is-fun
print("This is the first line.", end=" ") # Output: This is the first line. This is the second line.
print("This is the second line.")
The above is the detailed content of Python print() method. For more information, please follow other related articles on the PHP Chinese website!