Computers and Technology
Computers and Technology, 28.05.2021 14:00, kat9940

ASCII-Encoded String Many simple encoding methods have been devised over the years. A common method is the ASCII character set used to display characters on the screen. Each character is given a numeric value which can be interpreted by the computer. 
In this challenge, you will be given a string to decode. An example of an encoded string follows The table below shows the conversion from the string Hacker Rank to the ASCI string 729799107202114328297110107
Characteri aici P r e p I n s t a
ASCII Vai 97 99 107 101 11432 82 97 110 107
We then reverse the ASCII string to get the encoded string 701011792823411101701997927
To decode the string, first reverse the string of digits, then successively pick valid values from the string and convert them to their ASCII equivalents. Some of the values will have two digits, and others three. Use the ranges of valid values when decoding the string of digits. 
For reference, the characters in s correspond to the following ASCII values:
The value range for A through Z is 65 through 90.
The value range for a through z is 97 through 122.
The value of the space character is 32.
Function Description
Complete the function decode in the editor below. The function must return the original decoded string.
decode has the following parameteris
encoded an encoded string
Constraints
.1 <= |s| <= 105
. s[i] ∈ {}
Sample Input 0
23511011501782351112179911801562340 161171141148
Sample Output 0
Truth Always wins
Explanation 0
We reverse encoded to get 8411411711610432651082 1532 We then replace each ASCII Value with its corresponding character:
Python
num = input()
num = num[::-1]
Final_string = ''
number = ''
for i in range(len(num)):
number = number + num[i]
if (int(number) >= 65 and int(number) <= 90) or (int(number) >= 97 and int(number) <= 122) or (int(number) == 32):
character = chr(int(number))
Final_string+=character
number = ''
print(Final_string)
Output:
23511011501782351112179911801562340 161171141148
Truth Always Wins

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:10, lberman2005p77lfi
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
image
Computers and Technology, 23.06.2019 07:00, bskyeb14579
Why is investing in a mutual fund less risky than investing in a particular company's stock? a. mutual funds only invest in blue-chip stocks. b. investments in mutual funds are more liquid. c. mutual funds hold a diversified portfolio of stocks. d. investments in mutual funds offer a higher rate of return.
Answers: 2
image
Computers and Technology, 24.06.2019 01:00, kayranicole1
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
Answers: 1
image
Computers and Technology, 24.06.2019 01:30, shonnybenskin8
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
Do you know the correct answer?
ASCII-Encoded String Many simple encoding methods have been devised over the years. A common method...

Questions in other subjects:

Konu
Mathematics, 05.05.2020 19:39