Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. def Vvod():
  2. File = open('S.txt','w')
  3. for i in range(7):
  4. File.write(input('Введите элемент файла: ')+'\n')
  5. File.close()
  6. File = open('S.txt')
  7. File.close()
  8. def Sort():
  9. File = open('S.txt')
  10. dop=File.read()
  11. File.close()
  12. dop=dop.replace('\n','')
  13. for i in range(len(dop)):
  14. for j in range(i,len(dop)):
  15. if int(dop[i])>int(dop[j]):
  16. dop=dop[0:i]+dop[j]+dop[i]+dop[i+1:j]+dop[j+1:]
  17. File = open('S.txt','w')
  18. for i in range(len(dop)):
  19. if i!=len(dop)-1:
  20. File.write(dop[i]+'\n')
  21. else:
  22. File.write(dop[i])
  23. File.close()
  24. def Print():
  25. File = open('S.txt')
  26. read=File.read()
  27. print(read)
  28. File.close()
  29.  
  30. Vvod()
  31. Sort()
  32. Print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement