Question

For example, the following would be correct input and output >» student_courses (Elise:[1. Nelson :[cS1e0, MATH111]. Just in pyhton
0 0
Add a comment Improve this question Transcribed image text
Answer #1

def fileStats(fh , fh1):

    fh1=open("monthStatsOut.txt","w+")#create and opens file in write mode

    fh=open("monthStats.txt" , "r")#opens a file in read mode

    for line in fh:#for each line in file

        count=0# initialize count1 and count=0

        count1=0

        for word in line.split():#split it into spaces

            count=count+1#increment count

            for i in word:#for each element in word

                if i.isdigit():# if it is a digit then increments count1

                    count1=count1+1   

        fh1.write(str(count))# write to the file

        fh1.write("\t")# write to the file

        fh1.write(str(count1))# write to the file

        fh1.write("\n")# write to the file

    fh.close()#close the file

    fh1.close()#close the file

fileStats("monthStats.txt","monthStatsOut.txt")

def fileStats (fh fhl th1=open ( monthStatsOut .txt, w+)#create and opens file in write mode fh-open(monthStats.txt ,

2 1163

Add a comment
Know the answer?
Add Answer to:
in pyhton For example, the following would be correct input and output >» student_courses ('Elise:[1. Nelson :['cS1e0, MATH111']. 'Justin:t CS100']) >>> print (inve...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT