A1 The input file A1(input).txt has the following content for example: [a,b], [12, 'y']['1', 2, ¹2 3¹, x]: [ b, 123, ! ] Write a python program that can read and organize A1(input).txt into the output as shown below. Extra test line inputs may also be added by the examiner to fully test out your code's generality. Design your solution to be simple but general. Hints: Focus on using lists, for-loops, functions readlines, split, and replace. Extract bracketed contents: a, b 12, 'y' '1', 2, '2 3¹, b, 123, ! X Processed contents: a, b, One Two, y, One, Two, Two Three, x, b, One Two Three, !

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter3: Input/output
Section: Chapter Questions
Problem 1PE: 1. Consider the following incomplete C++ program: #include <iostream> int main() { … } a. Write a...
icon
Related questions
Question

Code this

A1
The input file A1(input).txt has the following content for example:
[a,b], [12, 'y']['1', 2, ¹2 3¹, x]:
[ b, 123, ! ]
Write a python program that can read and organize A1(input).txt into the output as
shown below. Extra test line inputs may also be added by the examiner to fully test out
your code's generality. Design your solution to be simple but general. Hints: Focus on
using lists, for-loops, functions readlines, split, and replace.
Extract bracketed contents:
a, b
12, 'y'
'1', 2, '2 3¹, X
b, 123, !
Processed contents:
a, b, One Two, y, One, Two, Two Three, x, b, One Two Three, !
Transcribed Image Text:A1 The input file A1(input).txt has the following content for example: [a,b], [12, 'y']['1', 2, ¹2 3¹, x]: [ b, 123, ! ] Write a python program that can read and organize A1(input).txt into the output as shown below. Extra test line inputs may also be added by the examiner to fully test out your code's generality. Design your solution to be simple but general. Hints: Focus on using lists, for-loops, functions readlines, split, and replace. Extract bracketed contents: a, b 12, 'y' '1', 2, '2 3¹, X b, 123, ! Processed contents: a, b, One Two, y, One, Two, Two Three, x, b, One Two Three, !
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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