# Count the number of words in WordList that start with a “q” [closed]

How can I create a subset of WordList[] that contains only the words that start with "g"?

## closed as off-topic by Artes, Carl Lange, MarcoB, corey979, CoolwaterMay 9 at 14:12

This question appears to be off-topic. The users who voted to close gave these specific reasons:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Artes, Coolwater
• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Carl Lange, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

• In general, it is a bad idea to give a title to a question that asks for a different thing than the question itself. – Henrik Schumacher May 9 at 9:36

You can use Select or Count or CountsBy with StringStartsQ:

Select[StringStartsQ["g"]]@WordList[]
Short @ %


{gab, gabardine, gabble, gabby, << 1213 >>, gyro, gyroscope, gyroscopic}

To get the counts

Length @ Select[StringStartsQ["g"]]@WordList[]


1220

Count[WordList[], _?(StringStartsQ["g"])]


1220

CountsBy[StringStartsQ["g"]] @ WordList[]


<|False -> 38907, True -> 1220|>

• The OP is asking for a subset, not how many are there... I thing you should remove Length and Count – J42161217 May 9 at 9:32
• @J42161217, good point. I went with the title: "Count the ..." – kglr May 9 at 9:35