Introduction
Introduction Statistics Contact Development Disclaimer Help
wikipediagame: show correct percentage with wrong guess - annna - Annna the nic…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit b88a487b93a248efa8a8c0079b328192de563607
parent c8452078103bd14dfbaa10f0254d8337b43aa004
Author: Anders Damsgaard <[email protected]>
Date: Tue, 11 Apr 2023 21:31:10 +0200
wikipediagame: show correct percentage with wrong guess
Signed-off-by: Annna Robert-Houdin <[email protected]>
Diffstat:
M wikipediagame | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/wikipediagame b/wikipediagame
@@ -9,6 +9,7 @@ import sys
import getopt
import wikipedia as w
import json
+from difflib import SequenceMatcher
def usage(app):
app = os.path.basename(app)
@@ -110,7 +111,8 @@ def main(args):
if os.path.exists(titlepath):
os.remove(titlepath)
else:
- print("Sorry, wrong guess.")
+ print("Sorry, wrong guess. (%.0f%% correct)" % \
+ (SequenceMatcher(None, title.strip().lower(), …
return 0
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.