Is it possible to print a string and a variable in a single print statement in Python?

0 votes
I am new to Python. I want to print a string and a variable together in a single statement. How to do it in Python?
Jul 15 in Python by Arvind
• 2,520 points
19 views

1 answer to this question.

0 votes

This can be done using simple string concatenation. For example,

name = "Arvind"
city= "Bangalore"
print("My name is " + name + " and I live in " + city)

The output will be - My name is Arvind and I live in Bangalore

answered Jul 15 by Neel
• 2,450 points

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,710 points
72 views
0 votes
1 answer

Is it possible in Python requests to print entire HTTP request?

A better idea is to use the ...READ MORE

answered Nov 26, 2018 in Python by Nymeria
• 3,500 points
49 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 168 views
+4 votes
6 answers
0 votes
1 answer

Is it possible to print all the modules imported in a python script?

Since I am using Python 3.6, I ...READ MORE

answered Jul 3 in Python by Neel
• 2,450 points
25 views
0 votes
1 answer

Is it possible to run a function in Python using the command line?

Suppose your file name is demo.py and ...READ MORE

answered Jun 26 in Python by Neel
• 2,450 points
41 views