Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
What do f"{7 / 3:.2f}", f"{5:03d}" and f"[{'ab':>5}]" show?
:.2f sets the digits after the point. < and > align the text.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
7 / 3 is , and :.2f shows two digits after the point: 2.33.:03d writes the whole number in three places, filled with zeros: 005.:>5 puts the text at the right of a space of characters: [ ab], with three spaces before ab.Log in to join the discussion.
Loading…