Python Strings Formatting Presentation


This is the presentation associated with the python string formatting video.

[dflip id=”3356″ ][/dflip]

Download Presentation

Python String Formatting Video Question

This is the question that was asked in the python string formatting video

Question : 

What is the output of the following code?
In [ ]:
print("Hello {1}, {0} was calling you and {3}.".format("Steve","Bill", "Tim"))

[bg_collapse view=”button-blue” color=”#ffffff” icon=”eye” expand_text=”Show Answer” collapse_text=”Hide Answer” ]

In [1]:
print("Hello {1}, {0} was calling you and {3}.".format("Steve","Bill", "Tim"))
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-1-280d42566930> in <module>
----> 1 print("Hello {1}, {0} was calling you and {3}.".format("Steve","Bill", "Tim"))

IndexError: tuple index out of range

[/bg_collapse]