Computer Science
From the string S = "CARPE DIEM", which ranges return "DIE" and "CAR"?
Python String Manipulation
17 Likes
Answer
- S[6:9] returns DIE
- S[:3] returns CAR
Answered By
9 Likes
Related Questions
Can you say strings are character lists? Why? Why not?
Given a string S = "CARPE DIEM". If n is length/2 (length is the length of the given string), then what would following return?
(a) S[: n]
(b) S[n :]
(c) S[n : n]
(d) S[1 : n]
(e) S[n : length - 1]What happens when from a string slice you skip the start and/or end values of the slice?
What would the following expressions return?
- "Hello World".upper( ).lower( )
- "Hello World".lower( ).upper( )
- "Hello World".find("Wor", 1, 6)
- "Hello World".find("Wor")
- "Hello World".find("wor")
- "Hello World".isalpha( )
- "Hello World".isalnum( )
- "1234".isdigit( )
- "123FGH".isdigit( )