6 Answers
+ 8
word = input("Enter the word: "))
print(word[0])
#The input is a string, so the first letter of the word is the 0th index. đ
+ 17
Thank you @LunarCoffee! đ I am interested in learning Java, have started a bit already âș
+ 15
Thank you @blackcat1111 đâș
+ 11
Python has a special indexing system for strings!
[start:stopbefore:steps]
for example, [1:7:2] takes characters from position one, then moves 2 chars forward then picks the next one, until it is <=7.
All these parameters are optional.
In this case, it is [0] the index you ned ti use
The explanation on top was for any general case in string indexing you might have queries in. Feel free to ask me if you have any doubts đ
+ 5
For future reference, a string is just an array of chars. Keep that in mind if you're going to learn and use other languages like Java. toCharArray() has uses.
+ 1
foo = input("Enter the word: "))
print(word[0])