A python program where user will enter sentences and your system displays all the words starting from alphabet 'a' | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

A python program where user will enter sentences and your system displays all the words starting from alphabet 'a'

can some one plssss help me by making me understand the logic behind the code. https://code.sololearn.com/cUd8O2sY28sD/?ref=app

28th Jan 2019, 2:54 PM
Nilutpol Kashyap
Nilutpol Kashyap - avatar
6 Answers
+ 2
Please include the code you're talking about.
28th Jan 2019, 4:38 PM
Diego
Diego - avatar
+ 2
I think you want to write a program that - takes user input as a string - splits the string into separate words - sorts the words alphabetically?
28th Jan 2019, 5:15 PM
Anna
Anna - avatar
+ 2
You can split the input into separate words with s.split(). Then you can use .startswith() to check if a word starts with 'a'. Pack those words in a list, count them, done.
28th Jan 2019, 5:33 PM
Anna
Anna - avatar
+ 1
28th Jan 2019, 5:12 PM
Nilutpol Kashyap
Nilutpol Kashyap - avatar
+ 1
Anna but my problem is that user will enter a sentence of several words and the program needs to count and output the number of words starting from letter "a". thanx
28th Jan 2019, 5:18 PM
Nilutpol Kashyap
Nilutpol Kashyap - avatar
0
https://code.sololearn.com/ct0kuO5deVxw/?ref=app Anna i have tried ur way but my code is not working. plz help me
28th Jan 2019, 5:47 PM
Nilutpol Kashyap
Nilutpol Kashyap - avatar