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, 2019 in Python by Arvind
• 2,980 points
135 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, 2019 by Neel
• 3,010 points

Related Questions In Python

0 votes
1 answer

Is it possible to read a text file into a string variable and then scrap the newlines?

This can be done easily in Python. ...READ MORE

answered Aug 7, 2019 in Python by Arvind
• 2,980 points
180 views
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,780 points
193 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,520 points
5,425 views
0 votes
1 answer
+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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,367 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,012 views
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, 2019 in Python by Neel
• 3,010 points
156 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, 2019 in Python by Neel
• 3,010 points
150 views