تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-13
السؤال
Transcribed Image Text:
Question 13 (20 points)
Write a function named fileStats. The function fileStats takes two parameters:
1. inFile, a string that is the name of an input file
2. outFile, a string that is the name of an output file
The function fileStats should read and analyze each line of the input file and write two
separated by a space, about the line to a corresponding line of the output file.
The two statistics for each line are
1. the number of words
2. the number of digits (digits are the characters in positive integers: 0, 1, 2...)
For example, if the file monthStats.txt contains the following lines:
February has 28 days or 29 in a leap year
January and March have 31 days
April has 30 days
Then the function call
fileStats ('monthStats.txt', 'monthStatsOut.txt')
should produce an output file monthStatsOut.txt with the following content
104
62
42
L
V
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.