70_builtins.py 648 B

1234567891011121314151617181920212223242526272829
  1. assert round(23.2) == 23
  2. assert round(23.8) == 24
  3. assert round(-23.2) == -23
  4. assert round(-23.8) == -24
  5. a = [1,2,3,-1]
  6. assert sorted(a) == [-1,1,2,3]
  7. assert sorted(a, reverse=True) == [3,2,1,-1]
  8. assert abs(0) == 0
  9. assert abs(1.0) == 1.0
  10. assert abs(-1.0) == 1.0
  11. assert abs(1) == 1
  12. assert abs(-1) == 1
  13. assert any([1])
  14. assert any([1,False,True])
  15. assert not any([])
  16. assert not any([False])
  17. assert all([])
  18. assert all([True])
  19. assert all([True, 1])
  20. assert not all([False])
  21. assert not all([True, False])
  22. assert not all([False, False])
  23. assert list(enumerate([1,2,3])) == [(0,1), (1,2), (2,3)]
  24. assert list(enumerate([1,2,3], 1)) == [(1,1), (2,2), (3,3)]