#L0005. 字符串切片
字符串切片
1. Description
Take a string s, starting position start, and ending position end. Slicing the string by starting & ending position.
2. Input & Output
Input:
- Use
input()as input. Notice that the value you get frominput()is a string - We ensure that
startandendare smaller than string length. Andstartis not larger thanend. - Refering code below to load multiple inputs
s = input().split(" ")
# 读取第一个输入,如果想要读入整数,就通过 int() 把它变成整数
input_1 = int(s[0])
# 读取第二个输入,不需要数字时,就保留字符串
input_2 = s[1]
Output:
- Use
print()for your output
Example
# Input:
AwesomeWorld 0 5
# Output:
Aweso
# Input:
Brilliant 2 3
# Output:
i