Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """"
- create file
- no of sentences
- words ending with s
- sentences beginning with a
- """
- def createFile():
- with open('lab4.txt', 'w') as file:
- a = input("Enter the content of the text file: ")
- file.write(a)
- print("File Created")
- def countSentences():
- with open('lab4.txt') as file:
- a = file.read()
- b = a.split('.')
- count = 0
- for k in b:
- count = count + 1
- def wordEndA():
- with open('lab4.txt') as file:
- a = file.read()
- b = a.split()
- for k in b:
- if k[-1] == "s":
- print(k)
- elif k[-1] == "." and k[-2] == "s":
- print(k)
- def sentenceBeginA():
- with open('lab4.txt') as file:
- a = file.read()
- b = a.split('.')
- for k in b:
- if k[0] in "aA":
- print(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement