How to Use Echo in Python

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
How to Use Echo in Python
Image Credit: DragonImages/iStock/Getty Images

Unlike PHP, the Python programming language does not have an "echo" function that produces a string of output information. Instead, Python uses another similar statement called "print" to produce the same effect. The Python print function evaluates each entered string expression in turn and relays it in simplified form. If the entered information contained within the print expression is not considered a string, it converts automatically to a string before output.

Advertisement

Step 1

Open a python evaluator or code editor.

Video of the Day

Step 2

Create a variable with which to define your string — for example, x = 'Hello' where "x" is the variable and "Hello" is your string. String values include items such as text, numerical content and expressions.

Advertisement

Step 3

Type the word "print" with a trailing left parenthesis after creating the variable.

Step 4

Type the variable you created after the starting parenthesis.

Advertisement

Step 5

Close the print function with a right parenthesis. You should have something like print(x) with "x" representing your variable.

Step 6

Enter this print function; the string you entered to represent the variable should be the output return you receive.

Video of the Day

Advertisement

Advertisement

references

Report an Issue

screenshot of the current page

Screenshot loading...