- 3
How to use the ASCII table on python interpreter
6 Réponses
+ 4
Kwanele Buhle ,
since you are talking about python, i can give you a short and rough overview how this is handled for this language.
(1) output of the 2 strings
word1='AAB'
word2='BC'
(2) mem. location of these strings -> they are different
mem. location of the strings: id(word1)=541490806832
mem. location of the strings: id(word2)=541490806960
(3) mem. location of the chars of the string -> word1. you can see that the duplicated char 'A' have the same location, so they share the memory
mem. location of the char of word1 id(char)=541491829104 => A <=
mem. location of the char of word1 id(char)=541491829104 => A <=
mem. location of the char of word1 id(char)=541492079728 => B <*
(4) mem. location of the chars of the string -> word2. and SURPRISINGLY the mem. location of the char 'B' also share memory with the same char but from an different string
mem. location of the char of word2 id(char)=541492079728 => B <*
mem. location of the char of word2 id(char)=541492079600 => C
[Program finished]
+ 3
Pls elaborate. Use how?
+ 3
Please specify Python in your post's tags for improved language context clarity
https://code.sololearn.com/W3uiji9X28C1/?ref=app
+ 3
Kwanele Buhle are you asking from ASCII to text or text to ASCII conversion ?
https://code.sololearn.com/cQxfG3ZWN84P/?ref=app
https://code.sololearn.com/cZ1LwFx8woQq/?ref=app
+ 1
Kwanele Buhle Well, the representation would be exactly the ASCII numbers for B and C, respectively. What's the question?
- 2
For example if this is the question
"Consider the string ‘BC’. What would be its representation in the memory of a computer, assuming that ASCII/UNICODE is used?
And the answer is required in hexadecimal