first letters
you are given three strings are inputs. write a program to print the first character of each string.
input
the first,second and third lines of input are strings.
explanation
consider the given strings to be apple, banana and carrot.we need to consider the first character in each of these strings we get the character a from the string apple. we get the character b from the string banana. we get the character c from the string carrot. so the final output should be abc
sample input 1
apple
banana
carrot
sample output 1
abc
sample input 1
very
important
person
sample output 2
vip
def first_three_character(strings):
strings = []
first_character = []
for i in range(1):
strings = [input("Enter first string: "), input("Enter second string: "),input("Enter third string: ")]
for string in strings:
first_character.append(string[i][0])
return first_character[0]+first_character[1]+first_character[2]
first_three_character(strings)
Comments
Leave a comment