PROGRAMMING:Analysis of valve status in workshop (exercise 5-4, fundamentals and applications of Python programming, Higher Education Society)
The CPU reads 1 byte of content through an 8-bit IO port and now stores it in a bytes object. Example: B '\ x45'; These eight points
Do not represent the current status of 8 valves in the workshop, 1 means that the valve is on, 0 means that the valve is off. Please design a program to parse 8 bytes from the bytes object
The current state of the valve, true for on and false for off. These eight states should be organized in a list, where the i-th element corresponds to the i-th element of the input byte
A bit.
Example of output format: [true, false, false, true, true, true, false, false]
###Input format:
Single byte bytes in the form of B '\ x45'( Note that it's hexadecimal
###Output format:
A list of eight Boolean values. The i-th element represents the i-th bit of the input byte (0-7 bits from low to high).
[True, False, True, False, False, False, True, False]
###Input example:
```in
b'\x01'
```
###Output example:
```out
[True, False, False, False, False, False, False, False]
```
answer:If there is no answer, please comment
Do not represent the current status of 8 valves in the workshop, 1 means that the valve is on, 0 means that the valve is off. Please design a program to parse 8 bytes from the bytes object
The current state of the valve, true for on and false for off. These eight states should be organized in a list, where the i-th element corresponds to the i-th element of the input byte
A bit.
Example of output format: [true, false, false, true, true, true, false, false]
###Input format:
Single byte bytes in the form of B '\ x45'( Note that it's hexadecimal
###Output format:
A list of eight Boolean values. The i-th element represents the i-th bit of the input byte (0-7 bits from low to high).
[True, False, True, False, False, False, True, False]
###Input example:
```in
b'\x01'
```
###Output example:
```out
[True, False, False, False, False, False, False, False]
```
answer:If there is no answer, please comment