Is possible to build variables moving from numbers to letters?(using python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is possible to build variables moving from numbers to letters?(using python)

variables

24th Oct 2017, 5:09 PM
Gianluca
Gianluca - avatar
14 Answers
+ 12
Actually, the chr() method kinda does exactly that ;)
24th Oct 2017, 8:43 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 12
>>> print(chr(65)) 'A' Is that what you mean?
24th Oct 2017, 8:55 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 11
Sorry for being maybe too far away. Maybe I understood your question wrong. Is that what you were looking for, to convert a number into its ASCII representation? I just don't really know what you mean by "moving from numbers to letters"... 🤷
25th Oct 2017, 6:40 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
@Gianluca, if "moving from number to letter" means to get a character given a number, then the chr() function returns a character that represents the number passed in as its argument. As @Kuba explained, the number that represents the letter 'A' is 65, you can lookup ASCII table for more info. Try this for example: chars = [65,66,67,68,69] for c in chars: print (chr(int(c))) Just an example, sorry if it's incorrect :)
24th Oct 2017, 9:06 PM
Ipang
+ 4
What do you mean by "moving from numbers to letters"? I can't understand, a little more detail, or example would be nice :)
24th Oct 2017, 7:35 PM
Ipang
+ 3
thank you for everything. I am going to.see the ASCII TAble
24th Oct 2017, 9:09 PM
Gianluca
Gianluca - avatar
+ 3
Ipang and kuba
24th Oct 2017, 9:09 PM
Gianluca
Gianluca - avatar
+ 3
The word "moving" causes confusion. Try "converting'
25th Oct 2017, 6:41 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
@Gianluca, if you can explain a little more about what you're looking for then people here will be glad to help, but if you wish to seek answers on your own you too have the freedom of choice. Welcome to SoloLearn :)
25th Oct 2017, 7:36 AM
Ipang
+ 2
I have studied the basic concepts.Is the "chr()" method far from me now?
24th Oct 2017, 8:49 PM
Gianluca
Gianluca - avatar
+ 2
you said me that the chr() method kinda does want i wanted to do .So I asked you if,being at my level,i am far from that knowledge. Now you wrote me >>> print(chr(65)) 'A' and i do not know what it means because this is my first day
24th Oct 2017, 9:05 PM
Gianluca
Gianluca - avatar
+ 1
how much far?
24th Oct 2017, 8:49 PM
Gianluca
Gianluca - avatar
+ 1
kuba I was not looking for that.So now I am going to look what I was looking for by my self.Thank you guys🙂
25th Oct 2017, 7:27 AM
Gianluca
Gianluca - avatar
+ 1
thank you😊
25th Oct 2017, 3:33 PM
Gianluca
Gianluca - avatar