Question: Python Chapter 4 Summary Assignment (reading files, converting binary to decimal, string logic)Up through this point of the course, we have learned how to work
Python
Chapter 4 Summary Assignment (reading files, converting binary to decimal, string logic)Up through this point of the course, we have learned how to work with numbers (int, float) and strings. We have also learned about binary numbers, decimal numbers as well as several types of constructs that can be applied for building logic. Further, we have utilized and worked with for loops, while loops, counters, if-else statements, etc.
In this assignment, you will apply material and knowledge gained through Chapter 4.
NOTE: This assignment will require the use of a text file (assignment4.txt). Please ensure that you grab this file for your assignment. It is located on Canvas under the Files section and is titled assignment4.txtFile assignment4.txt file contains a list of individual lines representing binary numbers (8 bits (or 1 one byte) in each number).
You are to read in each line of the assigenment4.txt file and calculate the value of the binary number in decimal format.
You should ensure that each byte is in fact 8 characters.
You should ensure that the characters in each byte are representative of a binary number; if they are not, you should produce an error for that particular line.
As you read in each line, you are to calculate each binary number and convert it to decimal.
You can print out the corresponding decimal value as you read it in and calculate its value.
00000000
11111111
01011100
02100000
01001111
11100011
01110011
00110010
000010
00100011
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
