+ 3

Can we split the string in a single character and then assign the value to each of the element

Using python or any other languages but I'll prefer to be in python,c, c++

25th Apr 2020, 3:22 PM
Khushboo Kumari
Khushboo Kumari - avatar
6 odpowiedzi
+ 2
You can try this out: x=['w','o','r','d'] list=[] for i in x: list.append(ord(i)-96) print(list)
25th Apr 2020, 6:40 PM
Tricker
+ 2
You can split a string as: x="word" print(list(x)) #output ['w','o','r','d'] And can you provide more information about your question's 2nd part?
25th Apr 2020, 3:51 PM
Tricker
+ 2
PythonPip Like 'w' is assigned as 21 on alphabetical order and so on
25th Apr 2020, 5:10 PM
Khushboo Kumari
Khushboo Kumari - avatar
+ 2
Sorry 23 PythonPip
25th Apr 2020, 5:54 PM
Khushboo Kumari
Khushboo Kumari - avatar
+ 2
Thanks man PythonPip
25th Apr 2020, 7:38 PM
Khushboo Kumari
Khushboo Kumari - avatar
+ 1
Khushboo Kumari 21 or 23?
25th Apr 2020, 5:31 PM
Tricker