Using string processing functions (see the table), and the strings declared belo
ID: 3583155 • Letter: U
Question
Using string processing functions (see the table), and the strings declared below, perform the tasks listed. First, the program gets input from a file, where the input string has the form: is enrolled in student first name course subject name (The values for the data in the blanks will vary in length.) The tasks to be done are (1) Replace the input student first name by the name in the string Two, and (2) Replace the course subject name by the course name in the string Three. Your solution should work with any input data, and with any string assignments to Two and Three.Explanation / Answer
text = readText(file, "r")
Two = "Charles"
Three = "Computer Technology"
for i in range(len(text)):
linesplit = text[ i ].split(' ')
linesplit[0] = Two
linesplit[4] = Three
write(new_file, linesplit.join(' ')
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.