Python Last Character from String


Python Last Character from String

Print last character from String in python

name=”pramod” 
pramod is a string and in this string there are 6 characters ‘p’,’r’,’a’,’m’,’o’,’d’ 
now we have to print last character that is “d” 
source code
def name(first_name):
return first_name[-1]
first_name=input("enter your first name")
print(name(first_name))

Python Last Character from String

Have any Question or Comment?

3 comments on “Python Last Character from String

Leave a Reply

Your email address will not be published. Required fields are marked *

Domain & free Hosting

Categories

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.