How to Print Variable in Python
Variables are containers for storing data values. In Python, a variable is created when we assign a value to it. Unlike other programming languages, there is no need to initialize the variables beforehand.
Variables are printed using a print() function(it was print statement in Python 2).
#python program #for printing variables num1 = 11 num2 = 8989 str1 = "Hello" lis1 = ['a', 'b', 'c'] print(num1) print(num1+12, num2) print(str1) print(lis1)
Output:
11 23 8989 Hello ['a', 'b', 'c']
Subscribe
Login
Please login to comment
0 Discussion