Write a program that will read from a text file and display onscreen only the odd number lines i.e. the first, third, fifth etc. lines from the file will be displayed while the even numbered lines will be skipped (not displayed)as. The program will always read from the same text file "input.txt", don't have your program prompt the user for a file name. Your program does not have to handle file input problems with exception handling. Nor does your program have to close the file. Finally you can assume that the file will consist at least one line of text, it won't be empty.   In python pls

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter14: Exception Handling
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program that will read from a text file and display onscreen only the odd number lines i.e. the first, third, fifth etc. lines from the file will be displayed while the even numbered lines will be skipped (not displayed)as. The program will always read from the same text file "input.txt", don't have your program prompt the user for a file name. Your program does not have to handle file input problems with exception handling. Nor does your program have to close the file. Finally you can assume that the file will consist at least one line of text, it won't be empty.

 

In python pls

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr