+ 2

How to assign string in any number ??

Like If I have to give a code to a user- 'abcde' So, that it converted into 01234 and respectively to the numbers when alphabets increase !

20th Sep 2019, 7:50 PM
Chris Evans
Chris Evans - avatar
9 Answers
+ 4
It worked Really it worked ! Thank a lot, you both was so helpful, I was searching it for ages 😂😂 I finally get it. Thank you gentlemen!
20th Sep 2019, 8:23 PM
Chris Evans
Chris Evans - avatar
+ 3
word = 'abcde' s = '' for letter in word: s+=str(ord(letter)-ord('a')) print(s)
20th Sep 2019, 8:13 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Just a min. Lem'me check this one I have been wondering for months , now I feeling that I have an idea now from this. Thank you so much!
20th Sep 2019, 8:15 PM
Chris Evans
Chris Evans - avatar
+ 1
Well, what about 'amde' ? It's also 01234, how are you planning to know which is which ?
20th Sep 2019, 8:09 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Right ! Never thought before.... Ok just tell from a to e... I use spaces in future! !
20th Sep 2019, 8:11 PM
Chris Evans
Chris Evans - avatar
+ 1
You can dm me if you need more help
20th Sep 2019, 8:24 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
I'm just born in learning coding, I surely need it. dm- ??
20th Sep 2019, 8:26 PM
Chris Evans
Chris Evans - avatar
+ 1
Direct message, like sending me a private message throught sololearn
20th Sep 2019, 8:27 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
I will do it for sure !
20th Sep 2019, 8:28 PM
Chris Evans
Chris Evans - avatar