Introduction To Python - Learn Python the hard way v2.0
voteup image
1

In the following statement, can we use a list instead of the Tuple?

print "my name is %s and I am a %s" % ('Ragini', 'Software Developer')

asked Oct 12, 2011

http://twitter.com/ragi_2's image

http://twitter.com/ragi_2

1 Answer:
voteup image
1

I believe you have to use tuple, but if you have a list, you could do something like this.

my_list = ['Ragini', 'Software Developer']

print "my name is %s and I am a %s" % tuple(my_list)

answered Oct 13, 2011

http://twitter.com/coding_insights's image

http://twitter.com/coding_insights

Provide an answer to this question.
This editor supports the markdown format. Please visit this page, If you are not familiar with Markdown.

Recent Course Updates: