+ 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++
6 Réponses
+ 2
You can try this out:
x=['w','o','r','d']
list=[]
for i in x:
list.append(ord(i)-96)
print(list)
+ 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?
+ 2
PythonPip Like 'w' is assigned as 21 on alphabetical order and so on
+ 2
Sorry 23 PythonPip
+ 2
Thanks man PythonPip
+ 1
Khushboo Kumari 21 or 23?