hang_man's People
hang_man's Issues
Issues
Part 2
is_word_guessed
Lines 64 to 67 in 3acdf65
Це еквівалентно
return word_copy == let_copy
.
get_available_letters
Lines 95 to 99 in 3acdf65
Це явно можна написати простіше, наприклад:
dif = l for l in string.ascii_lowercase if l not in letters_guesed
. Так у вас принаймні тільки один раз будуть копіюватися значення.
Part 3
Lines 143 to 144 in 3acdf65
Ви перевіряєте
letter_guessed
, а додаєте у letters_tried
. Через це ваша програма працює некоректно.
Line 132 in 3acdf65
Це порушує умову 3.D.6:
y
не рахується за голосну при розрахунку втрачених спроб.
Line 143 in 3acdf65
Спробуйте виводити текст у залежності від помилки, можливо ці дві умови варто розділити.
Part 4
match_with_gaps
Lines 197 to 200 in 3acdf65
Ці умови можна спростити об'єднавши. Крім того,
other_word[i] != '_'
завжди True
.
show_possible_matches
Іронічно, але ця функція не відповідає умові з 4.3В: вона не має нічого повертати, вона має відразу виводити. Її сигнатура має бути str -> None
, а не str -> str
.
Lines 215 to 218 in 3acdf65
Так краще не робити: рядки є іммутабельними, тому на кожному присвоєнні створюється новий рядок, що тягне за собою виділення пам'яті і т.д. Простіше додавати усі слова до списку, а потім викликати
' '.join(result)
.Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.