in as sequence daigram the rectangle on the dotted line indicates the __________ of the object concerned code example
Example 1: You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P.
You will be passed a file path P and string S on the command line. Output the number of times the string S appears in the file P.
file = open(P, 'r')
ptext = file.read()
print(ptext.count(S))
file.close()
Example 2: Fill in the gaps in the initials function so that it returns the initials of the words contained in the phrase received, in upper case.
def get_initials(fullname):
xs = (fullname)
name_list = xs.split()
initials = ""
for name in name_list:
initials += name[0].upper()
return initials