-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# languinger | ||
🦣 Move slowly, learn faster. This app will help you learn languages in the most relaxed way possible. | ||
# Bleverse AI Labs: Languinger | ||
|
||
🦣 Move slowly, learn faster. This app will help you learn languages in the most relaxed way possible. It is currently under development. | ||
|
||
## Initial Pre-Alpha Source | ||
|
||
- [Python Terminal File](./src/cmd/main.py) | ||
|
||
## How to Run | ||
|
||
### Python Terminal File | ||
|
||
```bash | ||
cd src/cmd | ||
``` | ||
|
||
```bash | ||
py main.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import random | ||
|
||
def get_user_input(options): | ||
while True: | ||
try: | ||
# Try to get user input | ||
choice = int(input("Your choice: ")) - 1 | ||
if 0 <= choice < len(options): | ||
return choice | ||
else: | ||
print("Invalid choice. Please choose a number between 1 and {}.".format(len(options))) | ||
except (EOFError, NotImplementedError): | ||
# If input() is not supported, simulate user input | ||
choice = simulate_user_input(options) | ||
print(f"Simulated user's choice: {choice + 1}") | ||
return choice | ||
|
||
def vocabulary_training(vocabulary): | ||
word, translations = random.choice(list(vocabulary.items())) | ||
print(f"Translate the word '{word}' to Ukrainian:") | ||
|
||
options = [translations] + random.sample([v for k, v in vocabulary.items() if k != word], 3) | ||
random.shuffle(options) | ||
|
||
for i, option in enumerate(options, start=1): | ||
print(f"{i}. {option}") | ||
|
||
# Get user input | ||
answer = get_user_input(options) | ||
|
||
if options[answer] == translations: | ||
print("Correct!") | ||
else: | ||
print(f"Wrong! The correct answer is: {translations}") | ||
|
||
vocabulary = { | ||
"apple": "яблуко", | ||
"car": "автомобіль", | ||
"house": "будинок", | ||
"boy": "хлопець", | ||
"girl": "дівчина" | ||
} | ||
|
||
vocabulary_training(vocabulary) |