condition = False
x = 1 if condition else 0
print(x)
print('\r')
print('-------------------')
num1 = 10_000_000_000
num2 = 10_000_000
total = num1 + num2
print(f'total = {total:,}')
print('\r')
print('-------------------')
""" f = open('shuleg.txt', 'r', encoding="utf-8")
file_contents = f.read()
f.close()
words = file_contents.split(' ')
word_count = len(words)
print(word_count)
"""
print('\r')
print('-----------Tricks---------')
with open('shuleg.txt', 'r', encoding='utf-8') as f:
file_contents = f.read()
words = file_contents.split(' ')
word_count = len(words)
print('word count = ', word_count)
print('\r')
print('-------------------')
names = ['Алтай', 'Хангай', 'Хэнтий', 'Ханхөхий', 'Хянган']
index = 1
for name in names:
print(index, name)
index += 1
print('\r')
print('-----------Tricks---------')
names = ['Алтай', 'Хангай', 'Хэнтий', 'Ханхөхий', 'Хянган']
for index, name in enumerate(names, start=1):
print(index, name)
print('\r')
print('-------------------')
names = ['Алтай', 'Хангай', 'Хэнтий', 'Ханхөхий', 'Хянган']
directions = ['Өрнө', 'Төв', 'Зүүн хойд', 'Умард', 'Дорно']
for index, name in enumerate(names):
direction = directions[index]
print(f'{name} нь {direction} зүгт байдаг.')
print('\r')
print('-----------Tricks---------')
names = ['Алтай', 'Хангай', 'Хэнтий', 'Ханхөхий', 'Хянган']
directions = ['Өрнө', 'Төв', 'Зүүн хойд', 'Умард', 'Дорно']
for name, direction in zip(names, directions):
print(f'{name} нь {direction} зүгт байдаг.')
print('\r')
print('-------------------')
names = ['Алтай', 'Хангай', 'Хэнтий', 'Ханхөхий', 'Хянган']
directions = ['Өрнө', 'Төв', 'Зүүн хойд', 'Умард', 'Дорно']
provinces = ['Баян-Өлгий, Ховд, Говь-Алтай', 'Архангай, Өвөрхангай, Завхан', 'Хэнтий, Төв', 'Хөвсгөл, Увс', 'Дорнод']
for name, direction, province in zip(names, directions, provinces):
print(f'{name} нь {direction} зүгт {province} аймгийн нутагт байдаг.')
print('\r')
print('-------------------')
names = ['Алтай', 'Хангай', 'Хэнтий', 'Ханхөхий', 'Хянган']
directions = ['Өрнө', 'Төв', 'Зүүн хойд', 'Умард', 'Дорно']
provinces = ['Баян-Өлгий, Ховд, Говь-Алтай', 'Архангай, Өвөрхангай, Завхан', 'Хэнтий, Төв', 'Хөвсгөл, Увс', 'Дорнод']
for value in zip(names, directions, provinces):
print(value)
print('\r')
print('-------------------')
a, b, *c = (1, 2, 3, 4, 5)
print(a)
print(b)
print(c)
print('\r')
print('-------------------')
a, b, *_ = (1, 2, 3, 4, 5)
print(a)
print(b)
print('\r')
print('-------------------')
a, b, *c, d = (1, 2, 3, 4, 5, 6, 7)
print(a)
print(b)
print(c)
print(d)
print('\r')
print('-------------------')