From 61963b97606b77935e4101238d51bf78e6e4c0ee Mon Sep 17 00:00:00 2001 From: Gi Soong Chee Date: Mon, 5 Feb 2018 13:05:50 +0800 Subject: [PATCH] added suggestion to question in comments --- Practical 2/q07_miles_to_kilometres.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Practical 2/q07_miles_to_kilometres.py b/Practical 2/q07_miles_to_kilometres.py index 53a57f7..6526397 100644 --- a/Practical 2/q07_miles_to_kilometres.py +++ b/Practical 2/q07_miles_to_kilometres.py @@ -6,4 +6,5 @@ for i in range(10): print("{0}\t{1:.3f}\t\t{2}\t\t{3:.3f}".format(i+1, (i+1) * 1.609, (i * 5 + 20), (i * 5 + 20)/1.609)) -# are there any other ways to print such columns other than \t ? \ No newline at end of file +# are there any other ways to print such columns other than \t ? +# you can use column width in the format specifier eg {0:10} will reserve 10 columns for the first value