Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

****IN PYTHON!

Write a function named file_stats that takes one string parameter (in_file) that is the name of an existing
text file. The function file_stats should calculate three statistics about in_file: the number of lines it
contains, the number of words and the number of characters, and print the three statistics on separate
lines. For example, the following would be the correct input and output:
>>> file_stats('created_equal.txt')
lines 2
words 13
characters 72
Note: The number of characters may vary slightly between operating systems. Similarly, the number of lines
may vary by 1 line, depending on the method used to calculate it.

 

I attached a picture of my code so far and a picture of what the text file reads.

#Exercise 2
text_in=open('/Users/kristynpatracuolla/Documents/dummy_3.txt.rtf')
file_stats('/Users/kristynpatracuolla/Documents/dummy_3.txt.rtf')
expand button
Transcribed Image Text:#Exercise 2 text_in=open('/Users/kristynpatracuolla/Documents/dummy_3.txt.rtf') file_stats('/Users/kristynpatracuolla/Documents/dummy_3.txt.rtf')
Helvetica
î Regular
↑
dummy_3.txt.rtf - Edited
12
a
4
B I U
1.0
2
3
5
0
6
7
The average temperature of Newark New Jersey on a Summer day is seventy degrees. The weather is very
nice. I love the weather. When it is warm out I like to wear shorts and sneakers. The sun shines nicely on
campus.
expand button
Transcribed Image Text:Helvetica î Regular ↑ dummy_3.txt.rtf - Edited 12 a 4 B I U 1.0 2 3 5 0 6 7 The average temperature of Newark New Jersey on a Summer day is seventy degrees. The weather is very nice. I love the weather. When it is warm out I like to wear shorts and sneakers. The sun shines nicely on campus.
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education