Tags
PHP , python
Asked 1 years ago
26 Apr 2023
Views 221
steave

steave posted

is there echo function in python?

PHP have echo to print string but is there echo function in python? i am learning Python but know PHP very well.
iptracker

iptracker
answered May 1 '23 00:00

function echo in Python, is print(). The print() function is used to output values to the console or other output streams .

Here's an example of using print() in Python:

print("Hello, world!")

This will output the string "Hello, world!" to the console.

You can also use print() to output variables or the results of expressions:

x = 10
y = 20
print("The sum of x and y is:", x + y)

This will output the string "The sum of x and y is: 30" to the console.

Note that print() in Python 3.x is a function, whereas in Python 2.x it is a statement. In Python 3.x, you need to enclose the arguments to print() in parentheses, whereas in Python 2.x, you don't. For example, in Python 3.x, you would write print("Hello, world!"), whereas in Python 2.x, you would write print "Hello, world!".
Post Answer