maliciousfiles / python-projects Goto Github PK
View Code? Open in Web Editor NEWA repository of all my python projects.
License: MIT License
A repository of all my python projects.
License: MIT License
If you create a template with two or more parts of speech, such as two different nouns, the program should return a complete madlib with each part of speech containing different words based on what the user said.
However, if you create a template with two or more parts of speech the program returns a KeyError
.
I looked at the code and know exactly what is wrong. Basically, when the program runs through, the template, it gathers all the words in square brackets and puts them into a dictionary. Whenever it comes across a repeating word, it overwrites the original entry instead of creating a new one. This means that when the program needs words, it finds only one (the overwritten one). This is an easy fix, (make each dictionary key unique), but I just wanted to let everyone know.
bakers_daughter.txt
in the my_madlibs
directory.Madlib.py
and set the file to bakers_daughter.txt
This bug puts a large constraint on template making. In most madlibs, there are repeating parts of speech. Whenever somebody has more than one part of speech such as [noun]
in the file and then runs the program, they get a KeyError
and the only way to get around this would be to name each part of speech differently, such as [noun1]
or [noun2]
which is unrealistic.
I propose an easy fix, where the program will track repeating words and name their dictionary keys differently.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.