@LearnPython3_
Learn Python For Free
4 years
Yesterday we gave the definition of a variable, and today we will know how to display them in the console in #python. To display a raw text or a variable in the console, the "print" function is used. The rest of the thread👇
1
0
1

Replies

@LearnPython3_
Learn Python For Free
4 years
An example to display only a plain text : print("My name is #python") or print('My name is #python') You can use single or double quotes to display plain text.
1
1
0
@LearnPython3_
Learn Python For Free
4 years
An example to display a variable age: print(age) age is a variable. We see the quotes have been removed, if we don't remove the quotes then the print function will take it as plain text instead of the variable age, and will not display the value of the age but the text age.
1
1
0
@LearnPython3_
Learn Python For Free
4 years
An example to display text and a variable at the same time Displaying the value of a variable without a description can be confusing for the readability of the code. print("I am", age," years old") you can see the comma as a separator between the text and the variable.
0
1
1