Beginner
Characters against bytes
word holds "naïve ₹". Make four variables: data is the UTF-8 bytes of word; char_count is the number of characters in word; byte_count is the number of bytes in data; restored is data decoded back to a string.
Then print 7 characters, 10 bytes using your variables in an f-string.
What Check tests
datais abytesobject with the UTF-8 encodingchar_countis 7byte_countis 10restoredequals the original word- The counts come from
len, anddatareally is decoded back - The program prints
7 characters, 10 bytes
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.