Focus on Basic file operations, exception handling. Save a copy of the file module6data.txt (Below) Write a program that will Open the file module6data.txt Create a second file named processed. txt Read the numbers from the first file one at a time. For each number write into second file, if possible, its Square Square root iii. Reciprocal (1/number)use a math module function for the square root. use exception handling to trap possible errors. Report the number of items in the original file and the number that were successfully stored in the second file. Report the number of each type of error: ValueError, ZeroDivisionError, TypeError 26 O 76 -91 85 -44 85 -95 -34 83 -64 -76 -41 89 0 83 -99 -69 8 -79 0 -32 -49 -89 85 79 -28 56 19 -93 -21 -23 82 51 -80 l 62 -78 -8 71 28 -73 0 -45 -73 28 -5 O -70 63 -36 -72 0 -76 -24 -59 0 -54 83 35 -3 88 -14 29 -35 17 27 -61 -42 49 83 38 79 -80 33 8 41 96 -94 46 71 8 76 -63 -36 93 -82 -68 -20 69 -57 -84 -29 -17 77 36 -89 -94 62 10 -69 -43 Use meaningful variable names. Single letter variable names are forbidden except as counters in loops. Use blank lines to separate major parts of a program or function. Use spaces around all operators. For example, write x = y + 5, NOT x=y+5 Use named constants, not magic numbers. Organize your python program file. Your file should have, in this order a full header comment, as specified in the guidelines any named constants used by the program, the definition of the main() function, all functions other than main(), the call to main()at the very bottom of the file.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Focus on Basic file operations, exception handling.

Save a copy of the file module6data.txt (Below)

Write a program that will

  1. Open the file module6data.txt
  2. Create a second file named processed. txt
  3. Read the numbers from the first file one at a time. For each number write into second file, if possible, its
  4. Square
  5. Square root

iii. Reciprocal (1/number)use a math module function for the square root. use exception handling to trap possible errors.

  1. Report the number of items in the original file and the number that were successfully stored in the second file.
  2. Report the number of each type of error: ValueError, ZeroDivisionError, TypeError

 

26

O

76

-91

85

-44

85

-95

-34

83

-64

-76

-41

89

0

83

-99

-69

8

-79

0

-32

-49

-89

85

79

-28

56

19

-93

-21

-23

82

51

-80

l

62

-78

-8

71

28

-73

0

-45

-73

28

-5

O

-70

63

-36

-72

0

-76

-24

-59

0

-54

83

35

-3

88

-14

29

-35

17

27

-61

-42

49

83

38

79

-80

33

8

41

96

-94

46

71

8

76

-63

-36

93

-82

-68

-20

69

-57

-84

-29

-17

77

36

-89

-94

62

10

-69

-43

 

  • Use meaningful variable names.  Single letter variable names are forbidden except as counters in loops.
  • Use blank lines to separate major parts of a program or function.
  • Use spaces around all operators. For example, write x = y + 5, NOT x=y+5
  • Use named constants, not magic numbers.  
  • Organize your python program file. Your file should have, in this order
    • a full header comment, as specified in the guidelines
    • any named constants used by the program, 
    • the definition of the main() function, 
    • all functions other than main(),  
    • the call to main()at the very bottom of the file. 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY