Python program to accept a character?

In Python we don't have any data type called Character as in Programming Languages like Java , C and C++.Now how we can take a character as input in Python.First of all think what is string.String is a sequence of character or list of character.Now if String is a List then we can access the individual characters by their index number.


#Python Program to input a character
character = input("Enter your character:")[0]#first character of string

--Thanks for Reading--

Post a Comment

Copyright © DevTipsNTricks. Designed by OddThemes