COMP-1034: Files and CSV Practice Problems 1. Write a Python script to read a text file and display its content. 2. Write a Python script to write a text file with some content. 3. Write a Python script to append text to an existing text file.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

COMP-1034: Files and CSV Practice Problems
1. Write a Python script to read a text file and display its content.
2. Write a Python script to write a text file with some content.
3. Write a Python script to append text to an existing text file.
4. Write a Python script to copy the contents of one file into another file.
5. Write a Python script to count the number of lines in a text file.
6. Write a Python script to read a text file and find the longest word.
7. Write a Python script to read a text file and find the shortest word.
8. Write a Python script to read a text file and replace a specific word with another word.
9. Write a Python script to read a CSV file and display the data.
10. Write a Python script to write a CSV file with some data.
11. Write a Python script to append data to an existing CSV file.
12. Write a Python script to count the number of rows in a CSV file.
13. Write a Python script to count the number of data rows in a CSV file. This means to exclude
the header row.
14. Write a Python script to count the number of columns in a CSV file. The columns are
identified on the first row.
15. Write a Python script to read a CSV file and display the first 5 rows not including the column
headers.
16. Write a Python script to read a CSV file and display the last 5 rows.
17. Create a CSV file in Jupyter that has 5 stocks: symbol, company name and quantity of
shares. Write a Python script to read the CSV file and calculate the sum of shares.
18. Write a Python script to read the CSV file in #17 and calculate the average number of
shares.
19. Write a Python script to read a CSV file in #17 and find the stock with the maximum number
of shares. 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Linux
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education