-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (40 loc) · 1.15 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import random
import i18n
def lang() -> None:
"""Language config"""
# set localisations directory
i18n.load_path.append('translations/')
# Default localisation
i18n.set('fallback', 'en-us')
try:
lang_choice: int = int(input('Choose your language: [1]=EN [2]=UA:'))
except ValueError:
print('Choose your language: [1]=EN [2]=UA:')
else:
if lang_choice == 2:
i18n.set('fallback', 'ua-ua')
else:
pass
def err() -> None:
"""Check for win"""
if choice == random.randint(1, 3):
print(i18n.t('locale.win'))
else:
print(i18n.t('locale.lose'))
if __name__ == "__main__":
# Language set
lang()
print(i18n.t('locale.welcome'))
# Main loop
while True:
try:
# Check input for integer from 1 to 3
choice: int = int(input(i18n.t('locale.thimble_number')))
except ValueError:
print(i18n.t('locale.thimble_number_error'))
else:
if 1 <= choice <= 3:
# Check for win
err()
else:
print(i18n.t('locale.thimble_number_error'))