Learn Python - 5 [print, printing]

in #python7 years ago

Photo 25.03.2018 7 13 41 PM.jpg
We already have seen print in previous posts. Now I want to focus on printing functionality. If you are a beginner it's a way to know your program really does what you want.

<p dir="auto"><code>print() is a function and print whatever you pass to this function as a parameter. You can pass multiple parameters to the <code>print() function. <pre><code>>>> print(45) 45 >>> print('Hello Jamie') Hello >>> print(1, True, 'Steem') 1 True Steem <p dir="auto">As you see multiple parameters can be any type.<br /> Now lets print variables values with <code>print(): <pre><code> >>> name = 'Joe' >>> print('Hello my name is', name) Hello my name is Joe >>> age = 29 >>> print(name, 'is', age, 'old') Joe is 29 old <p dir="auto">We can also concatenate strings with <code>+ while printing them: <pre><code>>>> print('a' + 'b' + 'c' + 'd') abcd <p dir="auto">But for numbers it's different, it adds two numbers: <pre><code>>>> print(4 + 5) 9