0
How can I extract letters from a single word in Python?
"APPLE" variables: p="A" q="P" r="P" s="L" t="E"
3 Answers
+ 4
Store the string "APPLE" in a variable, let's say fruit.
fruit[0] will return "A"
fruit[1] will return "B"
And so on. Hope that helps. Use a loop if required.
len(string) will return the length of string as an integer.
+ 2
Just declare a variable.Let str.
Then str="APPLE" #assign value
At last
Print(str[0],end="")
Print(str[1],end="")
Print(str[2],end="")
Print(str[3],end="")
Print(str[4],end="")
Like this u can print single character of string