- 3

Write a program that takes a string as input and output the last character of that string

word=(input()) print(word[:-1])

15th Nov 2021, 2:01 PM
joanna Godfrey
9 Réponses
+ 12
txt = str(input()) reverse = txt[::-1] last = reverse[0] print (last) this worked for me
1st Feb 2022, 9:56 PM
Salome Mkheidze
Salome Mkheidze - avatar
+ 4
it's simple do like this :- word=(input()) print(word[-1:])
20th Feb 2022, 5:52 PM
Ayush
Ayush - avatar
+ 1
joanna Godfrey Should be -1:
15th Nov 2021, 2:07 PM
A͢J
A͢J - avatar
+ 1
a = input() print(a[-1])
15th Jan 2022, 2:07 PM
Ihor Princ
Ihor Princ - avatar
+ 1
word=(input()) print(word[-1:])
23rd Feb 2022, 10:19 AM
MANOJ BABU MALLAKUNTA
+ 1
try this code: string = input() stringLen = len(string) print(string[::-(stringLen)])
5th Aug 2022, 7:46 PM
obi3112
obi3112 - avatar
0
txt = str(input()) reverse = txt[::-1] last = reverse[0] print (last) done...!
5th Mar 2022, 3:37 PM
Nikhila
0
a = input() print(a[-1])
31st Mar 2022, 1:23 PM
Ahmed Salouh Abdelmoried
- 1
Hi Godfrey! You can also do it like this word=(input()) print(word[-1])
15th Nov 2021, 2:25 PM
Python Learner
Python Learner - avatar