Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

In Python 2 I used:

print "a=%d,b=%d" % (f(x,n),g(x,n))

I've tried:

print("a=%d,b=%d") % (f(x,n),g(x,n))

1 Answer

0 votes
by (106k points)

The most recommended way to do is to use format method. Read more about it here

a, b = 1, 2 

print("a={0},b={1}".format(a, b))

Related questions

0 votes
1 answer
0 votes
1 answer
asked Dec 10, 2020 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
asked Oct 15, 2019 in Python by Sammy (47.6k points)

Browse Categories

...