Guest User

Untitled

a guest
Jan 17th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. f=open('input.txt')
  2. g=open('output.txt','w')
  3. s=[int(i) for i in f.read().split()]
  4. s=[i for i in s if (i>0 and i %2 == 0)]
  5. if s != []:
  6. print(str(min(s))+' '+str(max(s)), file = g)
  7. else:
  8. print('0', file = g)
  9. f.close()
  10. g.close()
  11.  
  12. f = """1
  13. 2
  14. 3
  15. 4
  16. -5
  17. -8"""
  18.  
  19. myList = [ i for i in f.split('n') if int(i) > 0 ]
  20.  
  21. print("{} {}".format(min(myList), max(myList)) if len(myList)==4 else "0")
  22. 1 4
  23.  
  24. f = """1
  25. 2
  26. 3
  27. -5
  28. -8"""
  29.  
  30. myList = [ i for i in f.split('n') if int(i) > 0 ]
  31.  
  32. print("{} {}".format(min(myList), max(myList)) if len(myList)==4 else "0")
  33. 0
Add Comment
Please, Sign In to add comment