Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Python Institute Exam PCAP-31-03 Topic 5 Question 47 Discussion

Actual exam question for Python Institute's PCAP-31-03 exam
Question #: 47
Topic #: 5
[All PCAP-31-03 Questions]

Assuming that String is six or more letters long, the following slice

String[1:-2]

is shorter than the original string by:

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Rossana
2 months ago
Hmm, I wonder if the correct answer is 'C) one char' and the question is just a silly joke to see if we're paying attention. You know, like 'the original string is shorter by one character because it's been sliced down'. Nah, that's probably too much of a stretch.
upvoted 0 times
Glendora
11 days ago
I agree with you, it must be 'C) one char'.
upvoted 0 times
...
Dorothy
1 months ago
I'm not sure, but I think it's 'B) three chars'.
upvoted 0 times
...
Nu
1 months ago
I think the correct answer is 'D) two chars'.
upvoted 0 times
...
...
Malcom
2 months ago
Ah, Python string slicing. This is a piece of cake! Let's see, 'String[1:-2]' means we're keeping everything except the first and last two characters. That's definitely D) two chars.
upvoted 0 times
Huey
3 days ago
Oh, I see now. Thanks for clarifying!
upvoted 0 times
...
Alaine
11 days ago
Actually, it's D) two chars. I'm sure of it.
upvoted 0 times
...
Thaddeus
23 days ago
No, I believe it's C) one char.
upvoted 0 times
...
Annett
1 months ago
I think it's D) two chars.
upvoted 0 times
...
...
Tyisha
2 months ago
The question is pretty straightforward. If the original string has six or more letters, and we're slicing out the first and last two, that's two characters on each end. So it's gotta be D) two chars.
upvoted 0 times
Fernanda
1 months ago
Yeah, I agree. Slicing out the first and last two characters would make it two chars shorter.
upvoted 0 times
...
Luis
1 months ago
I think it's D) two chars.
upvoted 0 times
...
...
Lavonda
2 months ago
I disagree, I think the answer is D) two chars because we are excluding the first and last characters.
upvoted 0 times
...
Emmett
2 months ago
I believe the answer is B) three chars.
upvoted 0 times
...
Annice
2 months ago
Okay, so we're slicing off the first and last two characters. That's gotta be four characters in total, right? I'm going with A) four chars.
upvoted 0 times
...
Izetta
2 months ago
Hmm, let me think about this. If String is six or more letters long, then the slice 'String[1:-2]' will exclude the first and last two characters, right? Sounds like it should be shorter by two chars.
upvoted 0 times
...
Lavonda
2 months ago
I think the answer is A) four chars.
upvoted 0 times
...
Rory
2 months ago
Hmm, that's interesting. Can you explain why you think it's two chars?
upvoted 0 times
...
Britt
2 months ago
I disagree, I believe the answer is D) two chars.
upvoted 0 times
...
Rory
3 months ago
I think the answer is B) three chars.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77