Print Single and Multiple variable in Python Last Updated : 16 Apr, 2025 Summarize Suggest changes Share Like Article Like Report In Python, printing single and multiple variables refers to displaying the values stored in one or more variables using the print() function.Let's look at ways how we can print variables in Python:Printing a Single Variable in PythonThe simplest form of output is displaying the value of a single variable using the print() function.Example: Python x = 42 print(x) Output42 Explanation: x stores the value 42, and print(x) displays it on the console.Printing Multiple VariablesPython allows printing multiple variables in various ways. Let’s explore three common techniques: 1. Using Commas (default way) Python a = 10 b = 20 c = 30 print(a, b, c) Output10 20 30 Explanation: When variables are separated by commas, Python prints them with a space between each.2. Using f-strings (formatted string literals) Python name = "Prajjwal" age = 23 print(f"My name is {name} and I am {age} years old.") OutputMy name is Prajjwal and I am 23 years old. Explanation:f-strings are prefixed with the letter f before the opening quote.Inside the string, curly braces {} act as placeholders for variables or expressions.Python automatically replaces each {} with the value of the corresponding variable.Note: f-strings is compatible with latest Python versions (Python 3.6+).3. Using .format() Method Python lang = "Python" ver = 3 print("You are learning {} version {}.".format(lang, ver)) OutputYou are learning Python version 3. Explanation:In the string, the curly braces {} act as placeholders..format() method replaces the {} in the string in order with the values passed to it.Note: .format() is compatible with older Python versions and still widely used in legacy code.Also read: f-strings, print(). Advertise with us Next Article Returning Multiple Values in Python K kartik Similar Reads How To Print A Variable's Name In Python In Python, printing a variable's name can be a useful debugging technique or a way to enhance code readability. While the language itself does not provide a built-in method to directly obtain a variable's name, there are several creative ways to achieve this. In this article, we'll explore five simp 3 min read Assigning multiple variables in one line in Python A variable is a segment of memory with a unique name used to hold data that will later be processed. Although each programming language has a different mechanism for declaring variables, the name and the data that will be assigned to each variable are always the same. They are capable of storing val 2 min read Returning Multiple Values in Python In Python, a function can return more than one value at a time using commas. These values are usually returned as a tuple. This is useful when a function needs to give back several related results together.Lets explore different ways to do it.Using TupleTuple is a group of values separated by commas 2 min read Variable Length Argument in Python In this article, we will cover about Variable Length Arguments in Python. Variable-length arguments refer to a feature that allows a function to accept a variable number of arguments in Python. It is also known as the argument that can also accept an unlimited amount of data as input inside the func 4 min read Multiline String in Python A sequence of characters is called a string. In Python, a string is a derived immutable data typeâonce defined, it cannot be altered. To change the strings, we can utilize Python functions like split, join, and replace.Python has multiple methods for defining strings. Single quotations (''), double 4 min read Multi-Line printing in Python We have already seen the basic use of print function previous article. Now, let's see how to use print function for multi-line printing. This can easily be done using multiline string i.e. three single quotes ''' Geeksforgeeks ''' . Let's see different examples to see the demonstration for the same. 1 min read Article Tags : Python Practice Tags : python Like