• Register

 

Variables are introduced in a special way in any programming language. Like other programming languages, you can define and print variables in Python. Our topic today is how to use print functions in Python.  How to print one or more variables while doing so. In any language, there are variables in which the amount of data contained in the data changes during the program. In fact, the variables themselves are nothing.  Rather, there are names of different places stored in memory. In these places of memory, a constant amount of integer-real or character can be stored. There are as many variable types in any language as there are constant types of that type of language.  Because variables are used to represent constant quantities, and print functions are used to output a simple text.

Printing multiple variables

Methods to print multiple variables,

 1: Passing multiple variables as arguments separating them by commas(,,,,,,,)

 2: Using format() method with curly braces ({})

 3: Using format() method with numbers in curly braces ({0})

 4: Using format() method with explicit name in curly braces ({v})

 5: Using string concatenation))))))


Nowadays you may have heard that computers are computers but computers themselves are useless. There is a lot of interaction between the computer and the users. But that's how Python came into the world of computers.  So much has developed that Python has become so important in the field of web pages. At the moment, Python is working on a great program. I am not able to describe the variables or many other features in Python.  I can, but I hope that this effort will be useful to me at the moment if seen in the field of computer, people who create web pages, etc. for sale or for their own needs. They have given up all language and Python  Everyone has come here because Python is a simple language. Variables play a very important role in all computer languages. Today we will introduce variables in a special way in Python. Let's look at some examples, let's practice and  Try to understand variables more.

name = "Tania"
age = 16
country = "Pakistan"

# printing variables one by one
print(name)
print(age)
print(country)
print() # prints a newline

# printing variables one by one
# with messages
print("Name:", name)
print("Age:", age)
print("Country:", country)

OUTPUT 
Tania
16
Pakistan
Name :Tania
Age:16
Country:Pakistan 

 

More Posts

Python for data analysis: data wrangling with pandas, numpy, and ipython Tasnia Sultana - May 28
How to count number of items in list python Tania - May 8
How to increment value in dictionary python Tania - May 8
How to check if a variable is an integer in python | by kodlogs Tania - May 4
How to merge two list in Python Prasandeep Gautam - Oct 19, 2020
How to take list input in Python Prasandeep Gautam - Oct 18, 2020
How to convert list into dictionary in Python Prasandeep Gautam - Oct 17, 2020
Python difference between return and print Tania - Feb 12
How to append to the beginning of a list python Tania - May 12
Python how to append to a list | by kodlogs Answer's... Tania - Apr 25