Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Coded in Python 9:59 V a github.com contributor 05 lines (74 sloc 3.14 KB 1 2 3 4 #1/usr/bin/env python # Name: [YOUR NAME GOES
Coded in Python
9:59 V a github.com contributor 05 lines (74 sloc 3.14 KB 1 2 3 4 #1/usr/bin/env python # Name: [YOUR NAME GOES HERE] # # Homework 4 # Follow the directions below. Add your code below the comments # to complete the assignment as directed. 8# 9 # This homework covers File I/0 COMBINED WITH your skills learned 10 # in prior lessons. 12 13 # 1. Write a block of code that opens the file getty,txt 14 # for "read" and prints the number of lines in the file 15 # HINT: is there a way to read the lines in and count them? 16 # line at a time? all at once? 17 18 19 20 #2. Write a block of code that opens the file getty. txt for 21 # "read" and prints the number of four-letter words in the 22 # file. 23 # HINT: should be able to do this lickitey-split() 24 25 26 27 #3. Write a block of code that reads num s.txt and then provides 28 # both the sum and the average of the numbers 29 # HINT: don't forget that these will be read in as strings 30 31 32 and will thus need converting 34 #4. write a block of code that asks the user for a filename. Then 35 # open that file in "append" mode and write YOUR first and last 36 # name to the file on two separate lines. 37 38 39 40 #5. Write a block of code that should prompt the user for the 41 # names of two text files. The contents of the first file 42 # should be read and written to the second file. 43 45 46 #6. Write a block of code that prompts the user for the names 47 # of two text files and compare the contents of the two files 48 # to see if they are the same. If they are, it should output 49 # "YES". If they are not, it should output "NO". 50 51 # Use a loop to read and compare the files one line at a time. 52 # The loop should 'break' as soon as a pair of different lines 53 # if found. 54 # 55 # HINT: This is a GREAT place to use that "else" clause for loops 56 57 9:59 V 9 github.com 52 # The loop should 'break, as soon as a pair of different lines 53 # if found. 54 55 # HINT: This is a GREAT place to use that "else" clause for loops. 56 57 58 59 #7. The payroll department keeps a list of employee information 60 # for each pay period in a text file called pay.txt. The format 61 # for each line in the file is comma separated, as follows: 62 63 #lastname>, chourly wage>,Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started