/
eb
/
python_learn
Обзор
Документация
Войти
/
eb
/
python_learn
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
python_3_8/walrus_operator.py
35 строк
655 B
EvgeniyBudaev
Walrus-оператор
01 мар 2021, 16:17
01 мар 2021, 16:17
8594267
Код
Авторство
О чём код?
# walrus = False # print(walrus) print(walrus := True) # === # rows = input('Enter the number: ') # for i in range(int(rows)): # print('*' * (i+1)) # print(f'Number of rows: {rows}') for i in range(rows := int(input('Enter the number'))): print('*' * (i+1)) print(f'Number of rows: {rows}') # === # def read_file(fp): # while True: # line = fp.readline() # if not line: # break # # split_line = line.split(';') # print(split_line[1]) def read_file(fp): while line := fp.readline(): if not line: break split_line = line.split(';') print(split_line[1])