VatariShin 3 месяцев назад
Родитель fd575b9283
Сommit b002f1a69f

@ -20,6 +20,7 @@
1) 1)
```py ```py
from random import randint from random import randint
from os import chdir
def getTupleNumbers(): def getTupleNumbers():
try: try:
@ -43,6 +44,7 @@ for _ in range(numbers): intTuple += (str(randint(101, 201)), )
``` ```
3) 3)
```py ```py
chdir('/Users/vatarishin/lab_sem_5/python-labs/TEMA6')
with open('test.txt', mode='w') as fl: with open('test.txt', mode='w') as fl:
for el in intTuple: for el in intTuple:
fl.write(f'{el}\n') fl.write(f'{el}\n')

@ -18,11 +18,9 @@ numbers = getTupleNumbers()
intTuple = () intTuple = ()
for _ in range(numbers): intTuple += (str(randint(101, 201)), ) for _ in range(numbers): intTuple += (str(randint(101, 201)), )
print(intTuple)
chdir('/Users/vatarishin/lab_sem_5/python-labs/TEMA6') chdir('/Users/vatarishin/lab_sem_5/python-labs/TEMA6')
with open('test.txt', mode='w') as fl: with open('test.txt', mode='w') as fl:
for el in intTuple: for el in intTuple:
print(el)
fl.write(f'{el}\n') fl.write(f'{el}\n')
del name, numbers, intTuple del name, numbers, intTuple

Загрузка…
Отмена
Сохранить