Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def enter_sentence():
- sentence = raw_input("Please enter a long sentence : ")
- string = sentence.replace(" ","")
- print "Last Character in the sentence :",string[-1:]
- print "Last 5 Characters in the sentence :",string[-5:]
- print "Character at 2nd and 5th positions are :"+string[1],string[4]
- center = int(len(string))/2
- end = center+1
- print "Character at the center of the string ,along with 2 adjoining characters is : ",string[center-2:end]
- # Main starts from here
- if __name__ == "__main__":
- print "Let's start"
- enter_sentence()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement