Python Test 2 - Formatting What will be the output of the following Python code snippet? X=”hi” print(“05d”%X) 00000hi 000hi error hi000 What will be the output of the following Python code snippet? X=”san-foundry” print(“%56s”,X) 56 blank spaces before san-foundry 56 blank spaces after san-foundry 56 blank spaces before san and foundry no change What will be the output of the following Python expression if x=456? print("%-06d"%x) 456 456000 000456 error What will be the output of the following Python expression if X=345? print(“%06d”%X) 345000000 345000 000000345 000345 Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’? print(“-ns”%S) print(“%-ns”%S) print(“%ns”%S) What will be the output of the following Python expression if X = -122? print("-%06d"%x) -00122 –00122 000122 -000122 What will be the output of the following Python expression if the value of x is 34? print(“%f”%x) 34.00000000 34.000000 34.0000 34.00 What will be the output of the following Python expression if x=56.236? print("%.2f"%x) 0056.236 56.00 56.24 56.23 What will be the output of the following Python expression if x=22.19? print("%5.2f"%x) 22.20 22.1900 22.19 22.00000 The expression shown below results in an error. print("-%5d0",989) False True Schreibe einen Kommentar Antworten abbrechenDu musst angemeldet sein, um einen Kommentar abzugeben.