Print Exact Slice Of String in Python

Print Exact Slice Of String
You need to take string input and two other numbers which will be the start and end point of the slice and you need to print that slice of string to the stdout.

Input Format
You will be taking a string as an input from stdin and two integers one on each line.

Constraints
1 <= |S| <= 10000

Output Format
You need to print the slice of the string to the stdout.
Sample TestCase 1

Input
Hello Techgig
1
4
Output
ello

import sys
def main():

# Write code here
word=raw_input()
one=input()
two=input()
obj=slice(one,two+1)
sys.stdout.write(str(word[obj]))



main()

Comments

Popular posts from this blog

Reasoning-Number Series

Reasoning-Letter Series

Profit and Loss