1.

Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’?(a) print(“-ns”%S)(b) print(“-ns”%S)(c) print(“%ns”%S)(d) print(“%-ns”%S)This question was addressed to me in a national level competition.This key question is from Formatting topic in portion Formatting & Decorators of Python

Answer» RIGHT answer is (d) print(“%-ns”%S)

For explanation: In order to ADD ‘n’ blank spaces after a given STRING ‘S’, we use the FORMATTING option:(“%-ns”%S).


Discussion

No Comment Found