Answer is A.
{:#<15} - This is adding # to the returned string to fill 15 characters. It does nothing if the string is greater than 15 characters.
{:#<10} - This is adding # to the returned string to fill 10 characters. It does nothing if the string is greater than 10 characters.
txt = '{:#<15} : {:#<10}'.format(key, str(value))
Key left-aligned with 15 characters, fill remaining with '#'.
Value left-aligned with 10 characters, fill remaining with '#'.
I have applied the same script and the output is A:
>>> args_dict = {
... '1st_item':'645298791871446',
... '2nd_item_that_must_display':'jlugyydt'
... }
>>> for key,value in args_dict.items():
... txt = '{:#<15} : {:#<10}'.format(key,str(value))
... print(txt)
...
1st_item####### : 645298791871446
2nd_item_that_must_display : jlugyydt##
>>>
Did anyone take the exam and have this question? What was the answer? While Python's books may have one answer, Cisco's exam's decision for the correct answer is what decides the correct answer for Cisco unfortunately, so would love to now.
in "B" - The value '6452987918' is truncated to 10 characters, which does not happen in Python's string formatting; the entire string should be displayed even if it exceeds the specified width.
upvoted 3 times
...
This section is not available anymore. Please use the main Exam Page.350-401 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Alondrix
Highly Voted 1 year, 6 months agosharonmiller
9 months, 2 weeks agosharonmiller
9 months, 2 weeks agoebulating
Highly Voted 9 months agochiacche
Most Recent 7 months, 2 weeks ago[Removed]
10 months, 3 weeks ago[Removed]
11 months, 2 weeks agoOsama_anwar
1 year, 1 month agogorillaenhanced
1 year, 2 months agoAM17212
1 year, 3 months agoJakubu1
1 year, 4 months agoMizuchan
1 year, 3 months agoreheheeeehe
1 year, 4 months agoWill_91
1 year, 6 months agoBoyuanLIU
1 year, 6 months ago