+ 1

first letters from sentence

How i can get the first letters from sentence in python Ex: input=hello Solo Learn output=h S L Edit : I try For letter in input(): Print(letter[0]) But not work

2nd Nov 2020, 1:40 PM
Toufik Salhi
Toufik Salhi - avatar
4 odpowiedzi
+ 2
print(' '.join([i[0] for i in input().split()]))
2nd Nov 2020, 1:54 PM
Yurii Ostapenko
Yurii Ostapenko - avatar
+ 2
What you tried..? First try it yourself and Post your attempt if you struck between....
2nd Nov 2020, 1:44 PM
Jayakrishna 🇮🇳
0
toufikdz (Give a reply after Edit to get notified other if you need further solution.) You are passing total string instead split it and pass list.. Like and to print in same line, make these change: for letter in input().split(): print(letter[0],end="")
2nd Nov 2020, 2:41 PM
Jayakrishna 🇮🇳
0
Thank u
2nd Nov 2020, 3:32 PM
Toufik Salhi
Toufik Salhi - avatar