subject

Ok so im going to list my question and then the work so far. Here is the code so far:(THE PROBLEM WITH THE CODE IS THAT THE IM SUPPOSE TO USE FIND() TO REPEATEDLY CHANGE THE OCCURRENCE OF THE WORD "MASK" TO THE WORD "HAT" IN THE FILE BUT AM KIND OF LOST HAVE BEEN WORKING ON THIS FOR A WEEK AND A HALF) ALSO I CAN NOT use the replace method, count method, split method, range() function, or lists in your solution. HAVE BEEN TRYING TO FIND SUM WAY TO USE FIND() BUT AM COMING UP SHORT

CODE:

#Get input file name

fileOne = input("Enter the input file name :")

#Get output file name

fileTwo = input("Enter the output file name :")

'''Get a string that will be searched in the source file

to locate all occurrences of the string'''

targetString = input("Enter the target string :")

'''Get a string that will replace each occurrence of the target

string in the source file'''

replacementString = input("Enter the replacement string :")
files =input("Enter a file with the word 'mask':")
#Open the input file in read mode

f1 = open(fileOne,"r+")

#Read the content of input file

content =f1.read()

#Replace the target string with the replacement string
content =f1.find('mask')
print(files[0:content]+ "hat"+ files[content +content:len(files)])
#Open the output file in write mode

f1 = open(fileTwo,"w")

'''Write the content after all of the occurrences of the target

string have been found and replaced by the replacement string'''

f1.close()


Ok so im going to list my question and then the work so far.

Here is the code so far:(THE PROBLEM
Ok so im going to list my question and then the work so far.

Here is the code so far:(THE PROBLEM

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
question
Computers and Technology, 22.06.2019 21:00
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 24.06.2019 22:30
Distinguish between a skill resume and a chronological resume and explain when it is best to use each format
Answers: 1
You know the right answer?
Ok so im going to list my question and then the work so far. Here is the code so far:(THE PROBLEM W...
Questions
question
Chemistry, 02.01.2021 21:40
question
Mathematics, 02.01.2021 21:40
question
English, 02.01.2021 21:40
Questions on the website: 13722359