Robotics & Artificial Intelligence
What would be the output of following code?
str1 = "Hello India"
s1 = str1[1:3]
print(s1)
- He
- el
- Hlo
- None of these
Python String Manipulation
2 Likes
Answer
el
Reason — String slicing extracts characters from the starting index up to (but not including) the ending index, so str1[1:3] returns the characters at index 1 and 2, which are e and l.
Answered By
3 Likes
Related Questions
What would be the output of following code ?
list1 = [2, 3, 4, 5, 6] print(list1[-2])- 3
- 4
- 5
- Error
Which of the following function is applicable in a tuple?
- insert
- append
- del
- None of these
What would be the output of following code?
Q1 = "Hello How are you" val = Q1.count("H") print(val)- 1
- 2
- 3
- 4
What are the warehouse robots and how are they used in the logistics industry?