Question: Please help with Python... Please clean up the code given above and make it read different input strings import sys fopen(rb.txt) state - 0 #

 Please help with Python... Please clean up the code given above

Please help with Python... Please clean up the code given above and make it read different input strings

import sys fopen("rb.txt") state - 0 # sys.argv[1], '' rb'') for byte in f.readO a -ord(byte) nbyte a-48 print("just read, a-", a, " byte-", byte) if state - 0: if nbyte-1: elif nbyte -- 0: else: state1 state - 0 print(" FATAL ERROR-1") elif state- 1: if nbyte elif nbyte -- 1: else: state 1 state - 0 print(" FATAL ERROR-2") print("finished reading the file, state-", state) import sys fopen("rb.txt") state - 0 # sys.argv[1], '' rb'') for byte in f.readO a -ord(byte) nbyte a-48 print("just read, a-", a, " byte-", byte) if state - 0: if nbyte-1: elif nbyte -- 0: else: state1 state - 0 print(" FATAL ERROR-1") elif state- 1: if nbyte elif nbyte -- 1: else: state 1 state - 0 print(" FATAL ERROR-2") print("finished reading the file, state-", state)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!