# Learn How To Print In Python With Examples!

**URL:** <https://onehack.st/t/learn-how-to-print-in-python-with-examples/61274>\
**Category:** Tutorials & Methods\
**Tags:** programming\
**Created:** [October 27, 2019, 6:22pm UTC](https://onehack.st/t/learn-how-to-print-in-python-with-examples/61274 "2019-10-27T18:22:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aina](https://onehack.st/user_avatar/onehack.st/aina/32/167469_2.png) [@Aina](https://onehack.st/u/Aina)\
**Post date:** [October 27, 2019, 6:22pm UTC](https://onehack.st/t/learn-how-to-print-in-python-with-examples/61274/1 "2019-10-27T18:22:06Z")

</div>

In this tutorial, you will learn-

- How to print simple string?
- How to print blank lines
- Print end command

## How to print simple string?

More often then not you require Print strings in your coding construct.

Here is how to do it in Python 3

**Example: 1**

To print the Welcome to 1Hack, use the print () function as follows:

print (“Welcome to 1Hack”)

**Output:**

Welcome to 1Hack

In Python 2, same example will look like

`print "Welcome to 1Hack"`

**Example 2:**

If you want to print the name of five countries, you can write:

```
print("USA") 
print("Canada") 
print("Germany") 
print("France") 
print("Japan")

```

**Output:**

```
USA 
Canada 
Germany 
France 
Japan

```

## How to print blank lines

Sometimes you need to print one blank line in your Python program. Following are an example to perform this task.

**Example:**

Let us print 8 blank lines. You can type:

`print (8 * "\n")`

or:

`print ("\n\n\n\n\n\n\n\n\n")`

**Here is the code**

```
print ("Welcome to 1Hack") print (8 * "\n") print 
("Welcome to 1Hack")

```

**Output**

Welcome to 1Hack

Welcome to 1Hack

## Print end command

By default, python’s print() function ends with a newline. This function comes with a parameter called ‘end.’ The default value of this parameter is ‘\n,’ i.e., the new line character. You can end a print statement with any character or string using this parameter. This is available in only in Python 3+

**Example 1:**

```
print ("Welcome to", end = ' ') 
print ("1Hack", end = '!')

```

**Output:**

Welcome to 1Hack!

**Example 2:**

# ends the output with ‘@.’

`print("Python" , end = '@')`

**Output:**

Python@

## ENJOY & HAPPY LEARNING! 👍
