Alphabet completion rateMorse Decode GolfHow bold is this post?Bacon's cipher: An Intro to SteganographyOutput the alphabet, the ALPHABET, or just a characterGolf a SentenceTwisting SentencesA Zealous “Quick Brown Fox” “Jumped” Along the Groovy SpiralAlphabet cannonM_ss_ng Lette_sFind a recursive acronym
Russian equivalents of 能骗就骗 (if you can cheat, then cheat)
Is having 4 bed leveling adjustment points rather than 3 problematic?
Delete all files from a folder using a bat that match a certain pattern in Windows 10
Dynamic Sql Query - how to add an int to the code?
Can US Supreme Court justices / judges be "rotated" out against their will?
Did the Russian Empire have a claim to Sweden? Was there ever a time where they could have pursued it?
How do I keep a running total of data in a column in Excel?
Journal standards vs. personal standards
Active wildlife outside the window- Good or Bad for Cat psychology?
Is it advisable to inform the CEO about his brother accessing his office?
A* pathfinding algorithm too slow
Rear derailleur got caught in the spokes, what could be a root cause
Why didn't Caesar move against Sextus Pompey immediately after Munda?
German idiomatic equivalents of 能骗就骗 (if you can trick, then trick)
Should Catholics in a state of grace call themselves sinners?
Automorphisms and epimorphisms of finite groups
What does 'in attendance' mean on a death certificate - England?
What was the first science fiction or fantasy multiple choice book?
Robots in a spaceship
Is it theoretically possible to hack printer using scanner tray?
Do electrons really perform instantaneous quantum leaps?
How would one prevent political gerrymandering?
How do banks maintain reserves?
What was the point of separating stdout and stderr?
Alphabet completion rate
Morse Decode GolfHow bold is this post?Bacon's cipher: An Intro to SteganographyOutput the alphabet, the ALPHABET, or just a characterGolf a SentenceTwisting SentencesA Zealous “Quick Brown Fox” “Jumped” Along the Groovy SpiralAlphabet cannonM_ss_ng Lette_sFind a recursive acronym
$begingroup$
Introduction
How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77.
Challenge
For an input string, return the percentage of letters of the English alphabet present in the string.
The answer can be in percentage or in decimal form.
The input string can have upper and lower case, as well as punctuation. However you can assume they have no diacritics or accentuated characters.
Test cases
Input
"Did you put your name in the Goblet of Fire, Harry?" he asked calmly.
Some valid outputs
77%, 76.9, 0.7692
Input:
The quick brown fox jumps over the lazy dog
All valid outputs:
100%, 100, 1
The expected output for "@#$%^&*?!" and "" is 0.
code-golf
$endgroup$
|
show 5 more comments
$begingroup$
Introduction
How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77.
Challenge
For an input string, return the percentage of letters of the English alphabet present in the string.
The answer can be in percentage or in decimal form.
The input string can have upper and lower case, as well as punctuation. However you can assume they have no diacritics or accentuated characters.
Test cases
Input
"Did you put your name in the Goblet of Fire, Harry?" he asked calmly.
Some valid outputs
77%, 76.9, 0.7692
Input:
The quick brown fox jumps over the lazy dog
All valid outputs:
100%, 100, 1
The expected output for "@#$%^&*?!" and "" is 0.
code-golf
$endgroup$
3
$begingroup$
Suggested test cases:"@#$%^&*?!",""
$endgroup$
– Adám
Jun 21 at 10:35
4
$begingroup$
If77%and76.9is accepted, is77accepted too?
$endgroup$
– Grzegorz Oledzki
Jun 21 at 10:43
$begingroup$
Percentages can have decimal parts too...
$endgroup$
– Jo King
Jun 21 at 11:54
2
$begingroup$
@Shaggy Last edit for OP was 16 hours ago, your answer was at 15 and your comment at 14. I mean, you're right but ???
$endgroup$
– Veskah
Jun 22 at 4:16
4
$begingroup$
If 20/26 may be rounded to 0.7692, 0.769 or 0.77, can I also round it to 0.8, 1 or 0? ;-)
$endgroup$
– Noiralef
Jun 22 at 22:42
|
show 5 more comments
$begingroup$
Introduction
How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77.
Challenge
For an input string, return the percentage of letters of the English alphabet present in the string.
The answer can be in percentage or in decimal form.
The input string can have upper and lower case, as well as punctuation. However you can assume they have no diacritics or accentuated characters.
Test cases
Input
"Did you put your name in the Goblet of Fire, Harry?" he asked calmly.
Some valid outputs
77%, 76.9, 0.7692
Input:
The quick brown fox jumps over the lazy dog
All valid outputs:
100%, 100, 1
The expected output for "@#$%^&*?!" and "" is 0.
code-golf
$endgroup$
Introduction
How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77.
Challenge
For an input string, return the percentage of letters of the English alphabet present in the string.
The answer can be in percentage or in decimal form.
The input string can have upper and lower case, as well as punctuation. However you can assume they have no diacritics or accentuated characters.
Test cases
Input
"Did you put your name in the Goblet of Fire, Harry?" he asked calmly.
Some valid outputs
77%, 76.9, 0.7692
Input:
The quick brown fox jumps over the lazy dog
All valid outputs:
100%, 100, 1
The expected output for "@#$%^&*?!" and "" is 0.
code-golf
code-golf
edited Jun 21 at 12:09
Teleporting Goat
asked Jun 21 at 10:13
Teleporting GoatTeleporting Goat
3925 silver badges8 bronze badges
3925 silver badges8 bronze badges
3
$begingroup$
Suggested test cases:"@#$%^&*?!",""
$endgroup$
– Adám
Jun 21 at 10:35
4
$begingroup$
If77%and76.9is accepted, is77accepted too?
$endgroup$
– Grzegorz Oledzki
Jun 21 at 10:43
$begingroup$
Percentages can have decimal parts too...
$endgroup$
– Jo King
Jun 21 at 11:54
2
$begingroup$
@Shaggy Last edit for OP was 16 hours ago, your answer was at 15 and your comment at 14. I mean, you're right but ???
$endgroup$
– Veskah
Jun 22 at 4:16
4
$begingroup$
If 20/26 may be rounded to 0.7692, 0.769 or 0.77, can I also round it to 0.8, 1 or 0? ;-)
$endgroup$
– Noiralef
Jun 22 at 22:42
|
show 5 more comments
3
$begingroup$
Suggested test cases:"@#$%^&*?!",""
$endgroup$
– Adám
Jun 21 at 10:35
4
$begingroup$
If77%and76.9is accepted, is77accepted too?
$endgroup$
– Grzegorz Oledzki
Jun 21 at 10:43
$begingroup$
Percentages can have decimal parts too...
$endgroup$
– Jo King
Jun 21 at 11:54
2
$begingroup$
@Shaggy Last edit for OP was 16 hours ago, your answer was at 15 and your comment at 14. I mean, you're right but ???
$endgroup$
– Veskah
Jun 22 at 4:16
4
$begingroup$
If 20/26 may be rounded to 0.7692, 0.769 or 0.77, can I also round it to 0.8, 1 or 0? ;-)
$endgroup$
– Noiralef
Jun 22 at 22:42
3
3
$begingroup$
Suggested test cases:
"@#$%^&*?!", ""$endgroup$
– Adám
Jun 21 at 10:35
$begingroup$
Suggested test cases:
"@#$%^&*?!", ""$endgroup$
– Adám
Jun 21 at 10:35
4
4
$begingroup$
If
77% and 76.9 is accepted, is 77 accepted too?$endgroup$
– Grzegorz Oledzki
Jun 21 at 10:43
$begingroup$
If
77% and 76.9 is accepted, is 77 accepted too?$endgroup$
– Grzegorz Oledzki
Jun 21 at 10:43
$begingroup$
Percentages can have decimal parts too...
$endgroup$
– Jo King
Jun 21 at 11:54
$begingroup$
Percentages can have decimal parts too...
$endgroup$
– Jo King
Jun 21 at 11:54
2
2
$begingroup$
@Shaggy Last edit for OP was 16 hours ago, your answer was at 15 and your comment at 14. I mean, you're right but ???
$endgroup$
– Veskah
Jun 22 at 4:16
$begingroup$
@Shaggy Last edit for OP was 16 hours ago, your answer was at 15 and your comment at 14. I mean, you're right but ???
$endgroup$
– Veskah
Jun 22 at 4:16
4
4
$begingroup$
If 20/26 may be rounded to 0.7692, 0.769 or 0.77, can I also round it to 0.8, 1 or 0? ;-)
$endgroup$
– Noiralef
Jun 22 at 22:42
$begingroup$
If 20/26 may be rounded to 0.7692, 0.769 or 0.77, can I also round it to 0.8, 1 or 0? ;-)
$endgroup$
– Noiralef
Jun 22 at 22:42
|
show 5 more comments
35 Answers
35
active
oldest
votes
1 2
next
$begingroup$
Python 3, 42 bytes
lambda s:len(*s.upper()-*s.lower())/26
Try it online!
We filter all the non-alphabetic characters out of the string by taking the (set) difference of the uppercase and lowercase representations. Then, we take the length and divide by 26.
Python 3, 46 bytes
lambda s:sum(map(str.isalpha,*s.lower()))/26
Try it online!
Count the unique alphabetic (lowercase) characters, and divide by 26. In Python 2 it would require 3 more characters; two for changing *... to set(...), and one for making 26 a float: 26., to avoid floor division.
Python 3, 46 bytes
lambda s:sum('`'<c<'bc -l
$endgroup$
– wastl
Jun 21 at 13:12
$begingroup$
Right. The variable is a reminder after another attempt. Thanks!
$endgroup$
– Grzegorz Oledzki
Jun 21 at 15:24
3
$begingroup$
42 bytes
$endgroup$
– Nahuel Fouilleul
Jun 21 at 15:29
$begingroup$
Can't "grep -io [a-z]" be shortened to "grep -o [A-z]" ?
$endgroup$
– Gnudiff
Jun 23 at 6:13
$begingroup$
@Gnudiff Assuming ASCII, that would also match all of [^_`].
$endgroup$
– jnfnt
Jun 23 at 23:45
add a comment ╙+C
Run and debug it
$endgroup$
add a comment |
$begingroup$
Python 2, 57 bytes
lambda i:len(set(o for o in i.lower()if o.isalpha()))/26.
Try it online!
A bit longer than the Python 3 answer from ArBo but posted as a different approach in Python 2 anyway.
$endgroup$
add a comment |
$begingroup$
Jelly, 8 bytes
ŒuØAe€Æm
Try it online!
Explanation
Œu | Convert to upper case
ØAe€ | Check whether each capital letter is present, returning a list of 26 0s and 1s
Æm | Mean
$endgroup$
add a comment |
$begingroup$
C, 95 bytes
f(char*s)32]=1;for(z=97;z<'z';*a+=a[z++]);return(*a*100)/26;
(note: rounds down)
Alternate decimal-returning version (95 bytes):
float f(char*s)int a[256]=,z;while(*s&&a[*s++
This borrows some from @Steadybox' answer.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
1
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
add a comment |
$begingroup$
K4, 14 13 bytes
Solution:
avg .Q.a in _
Explanation:
Rather stolen from inspired by Luis Mendo's Octave solution...
avg .Q.a in _ / the solution
_ / lowercase the input
in / 'in' function
.Q.a / "abcdefghijklmnopqrstuvwxyz"
avg / average (mean)
$endgroup$
add a comment |
$begingroup$
Python 3, 51 49 bytes
-2 bytes, thanks to alexz02
lambda s:len(*filter(str.isalpha,s.lower()))/26
Try it online!
$endgroup$
$begingroup$
49 byteslambda s:len(*filter(str.isalpha,s.lower()))/26
$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
add a comment |
$begingroup$
JavaScript (Node.js), 45 bytes
s=>~-s.match(/$|([a-z])(?!.*1)/ig).length/26
Try it online!
JavaScript (Node.js), 47 bytes
s=>(s.match(/([a-z])(?!.*1)/ig)||[]).length/26
Try it online!
$endgroup$
add a comment |
$begingroup$
V, 30, 29 bytes
ÓÁ
òóã±òAÝ/26.0|Óá
C="
Try it online!
$endgroup$
add a comment |
1 2
next
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f187207%2falphabet-completion-rate%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
35 Answers
35
active
oldest
votes
35 Answers
35
active
oldest
votes
active
oldest
votes
active
oldest
votes
1 2
next
$begingroup$
Python 3, 42 bytes
lambda s:len(*s.upper()-*s.lower())/26
Try it online!
We filter all the non-alphabetic characters out of the string by taking the (set) difference of the uppercase and lowercase representations. Then, we take the length and divide by 26.
Python 3, 46 bytes
lambda s:sum(map(str.isalpha,*s.lower()))/26
Try it online!
Count the unique alphabetic (lowercase) characters, and divide by 26. In Python 2 it would require 3 more characters; two for changing *... to set(...), and one for making 26 a float: 26., to avoid floor division.
Python 3, 46 bytes
lambda s:sum('`'<c<''for c in*s.lower())/26
Try it online!
Same length, essentially the same as the previous one, but without "built-in" string method.
answered Jun 21 at 14:05
recursiverecursive
6,85914 silver badges27 bronze badges
6,85914 silver badges27 bronze badges
add a comment |
add a comment |
$begingroup$
Python 2, 57 bytes
lambda i:len(set(o for o in i.lower()if o.isalpha()))/26.
Try it online!
A bit longer than the Python 3 answer from ArBo but posted as a different approach in Python 2 anyway.
$endgroup$
add a comment |
$begingroup$
Python 2, 57 bytes
lambda i:len(set(o for o in i.lower()if o.isalpha()))/26.
Try it online!
A bit longer than the Python 3 answer from ArBo but posted as a different approach in Python 2 anyway.
$endgroup$
add a comment |
$begingroup$
Python 2, 57 bytes
lambda i:len(set(o for o in i.lower()if o.isalpha()))/26.
Try it online!
A bit longer than the Python 3 answer from ArBo but posted as a different approach in Python 2 anyway.
$endgroup$
Python 2, 57 bytes
lambda i:len(set(o for o in i.lower()if o.isalpha()))/26.
Try it online!
A bit longer than the Python 3 answer from ArBo but posted as a different approach in Python 2 anyway.
edited Jun 21 at 14:29
answered Jun 21 at 13:42
ElPedroElPedro
3,99812 silver badges28 bronze badges
3,99812 silver badges28 bronze badges
add a comment |
add a comment |
$begingroup$
Jelly, 8 bytes
ŒuØAe€Æm
Try it online!
Explanation
Œu | Convert to upper case
ØAe€ | Check whether each capital letter is present, returning a list of 26 0s and 1s
Æm | Mean
$endgroup$
add a comment |
$begingroup$
Jelly, 8 bytes
ŒuØAe€Æm
Try it online!
Explanation
Œu | Convert to upper case
ØAe€ | Check whether each capital letter is present, returning a list of 26 0s and 1s
Æm | Mean
$endgroup$
add a comment |
$begingroup$
Jelly, 8 bytes
ŒuØAe€Æm
Try it online!
Explanation
Œu | Convert to upper case
ØAe€ | Check whether each capital letter is present, returning a list of 26 0s and 1s
Æm | Mean
$endgroup$
Jelly, 8 bytes
ŒuØAe€Æm
Try it online!
Explanation
Œu | Convert to upper case
ØAe€ | Check whether each capital letter is present, returning a list of 26 0s and 1s
Æm | Mean
edited Jun 22 at 16:42
answered Jun 21 at 11:55
Nick KennedyNick Kennedy
3,8847 silver badges12 bronze badges
3,8847 silver badges12 bronze badges
add a comment |
add a comment |
$begingroup$
C, 95 bytes
f(char*s)32]=1;for(z=97;z<'z';*a+=a[z++]);return(*a*100)/26;
(note: rounds down)
Alternate decimal-returning version (95 bytes):
float f(char*s)int a[256]=,z;while(*s&&a[*s++
This borrows some from @Steadybox' answer.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
1
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
add a comment |
$begingroup$
C, 95 bytes
f(char*s)32]=1;for(z=97;z<'z';*a+=a[z++]);return(*a*100)/26;
(note: rounds down)
Alternate decimal-returning version (95 bytes):
float f(char*s)int a[256]=,z;while(*s&&a[*s++
This borrows some from @Steadybox' answer.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
1
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
add a comment |
$begingroup$
C, 95 bytes
f(char*s)32]=1;for(z=97;z<'z';*a+=a[z++]);return(*a*100)/26;
(note: rounds down)
Alternate decimal-returning version (95 bytes):
float f(char*s)int a[256]=,z;while(*s&&a[*s++
This borrows some from @Steadybox' answer.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
C, 95 bytes
f(char*s)32]=1;for(z=97;z<'z';*a+=a[z++]);return(*a*100)/26;
(note: rounds down)
Alternate decimal-returning version (95 bytes):
float f(char*s)int a[256]=,z;while(*s&&a[*s++
This borrows some from @Steadybox' answer.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Jun 22 at 23:27
AnonymousAnonymous
111 bronze badge
111 bronze badge
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Anonymous is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
add a comment |
1
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
1
1
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
$begingroup$
Welcome! Good first answer. It might be helpful for people reading your answer if you provide a short explanation of your code or an ungolfed version. It may also be helpful to provide a link to an online interpreter with your runnable code (see some other answers for examples). Many use TIO, and here's the gcc interpreter
$endgroup$
– mbomb007
Jun 23 at 0:13
add a comment |
$begingroup$
K4, 14 13 bytes
Solution:
avg .Q.a in _
Explanation:
Rather stolen from inspired by Luis Mendo's Octave solution...
avg .Q.a in _ / the solution
_ / lowercase the input
in / 'in' function
.Q.a / "abcdefghijklmnopqrstuvwxyz"
avg / average (mean)
$endgroup$
add a comment |
$begingroup$
K4, 14 13 bytes
Solution:
avg .Q.a in _
Explanation:
Rather stolen from inspired by Luis Mendo's Octave solution...
avg .Q.a in _ / the solution
_ / lowercase the input
in / 'in' function
.Q.a / "abcdefghijklmnopqrstuvwxyz"
avg / average (mean)
$endgroup$
add a comment |
$begingroup$
K4, 14 13 bytes
Solution:
avg .Q.a in _
Explanation:
Rather stolen from inspired by Luis Mendo's Octave solution...
avg .Q.a in _ / the solution
_ / lowercase the input
in / 'in' function
.Q.a / "abcdefghijklmnopqrstuvwxyz"
avg / average (mean)
$endgroup$
K4, 14 13 bytes
Solution:
avg .Q.a in _
Explanation:
Rather stolen from inspired by Luis Mendo's Octave solution...
avg .Q.a in _ / the solution
_ / lowercase the input
in / 'in' function
.Q.a / "abcdefghijklmnopqrstuvwxyz"
avg / average (mean)
edited Jun 23 at 8:55
answered Jun 23 at 8:46
streetsterstreetster
2,8896 silver badges15 bronze badges
2,8896 silver badges15 bronze badges
add a comment |
add a comment |
$begingroup$
Python 3, 51 49 bytes
-2 bytes, thanks to alexz02
lambda s:len(*filter(str.isalpha,s.lower()))/26
Try it online!
$endgroup$
$begingroup$
49 byteslambda s:len(*filter(str.isalpha,s.lower()))/26
$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
add a comment |
$begingroup$
Python 3, 51 49 bytes
-2 bytes, thanks to alexz02
lambda s:len(*filter(str.isalpha,s.lower()))/26
Try it online!
$endgroup$
$begingroup$
49 byteslambda s:len(*filter(str.isalpha,s.lower()))/26
$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
add a comment |
$begingroup$
Python 3, 51 49 bytes
-2 bytes, thanks to alexz02
lambda s:len(*filter(str.isalpha,s.lower()))/26
Try it online!
$endgroup$
Python 3, 51 49 bytes
-2 bytes, thanks to alexz02
lambda s:len(*filter(str.isalpha,s.lower()))/26
Try it online!
edited Jun 24 at 8:42
answered Jun 23 at 17:26
ruoholaruohola
1415 bronze badges
1415 bronze badges
$begingroup$
49 byteslambda s:len(*filter(str.isalpha,s.lower()))/26
$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
add a comment |
$begingroup$
49 byteslambda s:len(*filter(str.isalpha,s.lower()))/26
$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
$begingroup$
49 bytes
lambda s:len(*filter(str.isalpha,s.lower()))/26$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
49 bytes
lambda s:len(*filter(str.isalpha,s.lower()))/26$endgroup$
– alexz02
Jun 24 at 8:34
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
$begingroup$
@alexz02 Thank you! :)
$endgroup$
– ruohola
Jun 24 at 8:42
add a comment |
$begingroup$
JavaScript (Node.js), 45 bytes
s=>~-s.match(/$|([a-z])(?!.*1)/ig).length/26
Try it online!
JavaScript (Node.js), 47 bytes
s=>(s.match(/([a-z])(?!.*1)/ig)||[]).length/26
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript (Node.js), 45 bytes
s=>~-s.match(/$|([a-z])(?!.*1)/ig).length/26
Try it online!
JavaScript (Node.js), 47 bytes
s=>(s.match(/([a-z])(?!.*1)/ig)||[]).length/26
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript (Node.js), 45 bytes
s=>~-s.match(/$|([a-z])(?!.*1)/ig).length/26
Try it online!
JavaScript (Node.js), 47 bytes
s=>(s.match(/([a-z])(?!.*1)/ig)||[]).length/26
Try it online!
$endgroup$
JavaScript (Node.js), 45 bytes
s=>~-s.match(/$|([a-z])(?!.*1)/ig).length/26
Try it online!
JavaScript (Node.js), 47 bytes
s=>(s.match(/([a-z])(?!.*1)/ig)||[]).length/26
Try it online!
edited Jun 25 at 2:35
answered Jun 24 at 4:42
tshtsh
10.2k1 gold badge16 silver badges57 bronze badges
10.2k1 gold badge16 silver badges57 bronze badges
add a comment |
add a comment |
$begingroup$
V, 30, 29 bytes
ÓÁ
òóã±òAÝ/26.0|Óá
C="
Try it online!
$endgroup$
add a comment |
$begingroup$
V, 30, 29 bytes
ÓÁ
òóã±òAÝ/26.0|Óá
C="
Try it online!
$endgroup$
add a comment |
$begingroup$
V, 30, 29 bytes
ÓÁ
òóã±òAÝ/26.0|Óá
C="
Try it online!
$endgroup$
V, 30, 29 bytes
ÓÁ
òóã±òAÝ/26.0|Óá
C="
Try it online!
edited Jun 21 at 20:34
answered Jun 21 at 20:28
DJMcMayhem♦DJMcMayhem
41.2k12 gold badges153 silver badges321 bronze badges
41.2k12 gold badges153 silver badges321 bronze badges
add a comment |
add a comment |
1 2
next
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f187207%2falphabet-completion-rate%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
$begingroup$
Suggested test cases:
"@#$%^&*?!",""$endgroup$
– Adám
Jun 21 at 10:35
4
$begingroup$
If
77%and76.9is accepted, is77accepted too?$endgroup$
– Grzegorz Oledzki
Jun 21 at 10:43
$begingroup$
Percentages can have decimal parts too...
$endgroup$
– Jo King
Jun 21 at 11:54
2
$begingroup$
@Shaggy Last edit for OP was 16 hours ago, your answer was at 15 and your comment at 14. I mean, you're right but ???
$endgroup$
– Veskah
Jun 22 at 4:16
4
$begingroup$
If 20/26 may be rounded to 0.7692, 0.769 or 0.77, can I also round it to 0.8, 1 or 0? ;-)
$endgroup$
– Noiralef
Jun 22 at 22:42