r/dailyprogrammer • u/mattryan • Mar 07 '12
[3/7/2012] Challenge #19 [easy]
Challenge #19 will use The Adventures of Sherlock Holmes from Project Gutenberg.
Write a program that counts the number of alphanumeric characters there are in The Adventures of Sherlock Holmes. Exclude the Project Gutenberg header and footer, book title, story titles, and chapters. Post your code and the alphanumeric character count.
8
Upvotes
2
u/luxgladius 0 0 Mar 07 '12
Alphanumeric characters as in only the characters that are A-Z, a-z, and 0-9? Odd request, but ok. Hardest part is removing all the stuff, but I've already done that for the other two, so...
Perl
Output 431301
2
u/[deleted] Mar 08 '12 edited Mar 08 '12
Perl utilizing bash with wget. No other languages going to try?
1
u/bigmell Mar 07 '12 edited Mar 07 '12
Perl pass the txt file as a command line arg.
1
u/cooper6581 Mar 08 '12
Python:
Output:
1
u/ragtag_creature Dec 19 '22
R
Output:
1
u/Kil_Roy Mar 08 '12
After 3 hours, in python =D
Notes:
I'm new at this, advising greatly appreciated
For some reason whenever I tried to create an empty list, then fill it with my for loops I received the following error:
I'm still not sure why... can anyone help me?
Also, I returned 390,539 for the number of characters.