Skip to content

Commit

Permalink
🐍 feat(app): add py file
Browse files Browse the repository at this point in the history
  • Loading branch information
blefnk committed Jul 13, 2023
1 parent bc742bb commit 12f9f9a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
21 changes: 19 additions & 2 deletions README.md
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
```
44 changes: 44 additions & 0 deletions src/cmd/main.py
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)

0 comments on commit 12f9f9a

Please sign in to comment.