a Write a program that reads in a text file, infilet and prints out all the lines in the file to the screen until it enc
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
a Write a program that reads in a text file, infilet and prints out all the lines in the file to the screen until it enc
a Write a program that reads in a text file, infilet and prints out all the lines in the file to the screen until it encounters a line with fewer than 4 characters Once it finds a shortline Tone with fewer than a characters the program stops. That short line is not printed. Your programmustuse teadlin) to read one line at a time. Remember that a newLine is a character too For your testing you should create a file named infile.ot. Only upload your Python program, I will create my own infile.txt Your loop should be controlled by a loop that uses a condition involving elther for Please use a while-loop but do not use bak. Also only have ont condition in your solutions do NOT have it anothecondsson inside your loop Hint Determine the length of the first line of the file before the loop. The length of the second and subsequent should be examined inside the body of the loop. You could also look at the first few programs that Zelle covers dealing with
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!