In python, The function decodeFromAscii takes a list L of integers in the range 32 through 126. Each item in L is an ASCII code representing a single printable character. The function accumulates the string of characters represented by the list of ASCII codes and returns that string.
In python, The function decodeFromAscii takes a list L of integers in the range 32 through 126. Each item in L is an ASCII code representing a single printable character. The function accumulates the string of characters represented by the list of ASCII codes and returns that string.
For example, decodeFromAscii([78, 105, 99, 101, 33]) returns "Nice!" because N is chr(78), i is chr(105), c is chr(99), etc.
Note: ASCII was created in the 1960's so programmers could have a standard encoding for common keyboard characters as numbers. It was later expanded to create Unicode so that characters from languages other than English, mathematical symbols, and many other symbols could also be represented by numerical codes.
For example:
Test | Result |
---|---|
print(decodeFromAscii([36, 49, 44, 48, 48, 48])) | $1,000 |
print(decodeFromAscii([115, 110, 111, 119])) | snow |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images