Compare commits
3
Commits
main
..
039cfad400
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
039cfad400 | ||
|
|
00884f7e16 | ||
|
|
9caf0d2fb0 |
@@ -0,0 +1,2 @@
|
|||||||
|
.venv/
|
||||||
|
output.txt
|
||||||
@@ -1,2 +1 @@
|
|||||||
# py_repo
|
Задание: считать данные из файла data.txt, провести сортировку чисел по убыванию
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
numpy==2.2.3
|
||||||
|
pandas==2.2.3
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
pytz==2025.1
|
||||||
|
six==1.17.0
|
||||||
|
tzdata==2025.1
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
with open('data.txt', 'r') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
|
||||||
|
numbers = [int(line.strip()) for line in lines]
|
||||||
|
|
||||||
|
sorted_numbers = sorted(numbers, reverse=True)
|
||||||
|
|
||||||
|
with open('output.txt', 'w') as output_file:
|
||||||
|
for number in sorted_numbers:
|
||||||
|
output_file.write(f"{number}\n")
|
||||||
Reference in New Issue
Block a user