Parity Bit Generator

Parity Bit Generator

During the last I3E Industrial Conference in Robo-city, a new version of the communication protocol R2HI 2.0 (Robot-to-Human Interface) was adopted. A new version of the R2HI interface extends the existing one by adding an error detection feature. This feature allows us to send data to robots located a long distance away near some human settlements with higher level of reliability. During the data transmission some bits can be substituted due to external events (radiation impact, different noises etc.). In R2HI 2.0 simple parity bit check technique is proposed.

R2HI 2.0 interface specification:
1. Data packages (message) are represented as a list of int numbers (0 ≤ number ≤ 255):
[d1, d2, d3, ..., dn], where d1 is the first letter in message
2. Each decimal number is an ASCII-code of respective characters in binary + parity bit
Example:

    Chr | Dec  |   Bin   |P|  Bin + P | Dec
    ---------------------------------------
    'P' |  80  | 1010000 |0| 10100000 | 160
    'y' | 121  | 1111001 |1| 11110011 | 243
    't' | 116  | 1110100 |0| 11101000 | 232
    'h' | 104  | 1101000 |1| 11010001 | 209
    'o' | 111  | 1101111 |0| 11011110 | 222
    'n' | 110  | 1101110 |1| 11011101 | 221

        Message = [160, 243, 232, 209, 222, 221]
    

You have to implement an "R2HI 2.0 translator/analyzer" that translates a received data package (list of int) into a string message. Before the translation, erroneous numbers must be removed from the package (list). Erroneous means the decimal value contains a wrong (odd) number of '1' in a binary form:

'P' → 80 → 1010000 + 0 → 10100000 → ...101 1 0000... → 10110000 (Erroneous, 4-th bit was inverted)
Notice: During the data transmission one bit can be wrong (substituted) at most.

How it Works:
Input message: [144, 16, 210, 214]
Remove erroneous characters (binary): [10010000, 00010000 , 11010010, 11010110 ]
Binary result (remove parity bit): [1001000 0 , 1101001 0 ]
Decimal: [72, 105]
Message string (ASCII): "Hi"

Input: A list of int numbers

Output: Message as a string

Example:

How it is used: Parity bits are used as the simplest form of error detecting code . They allow you to detect odd numbers of bit substitutions in data.

Precondition: 1 ≤ len(message) < 100
all(m for m in message if i.isprintable())
0 ≤ number ≤ 255

Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.

×
 
 
<< <
> >>
exec show

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in a moment
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Go to the next mission