Mochinov

Untitled

Sep 21st, 2021
856
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # первый вариант
  2.  
  3. arr = [2, 4, 5, 6, 7.3, 5.2]
  4.  
  5. def convert_to_int(num):
  6.     return int(num)
  7.  
  8. arr = list(map(convert_to_int, arr))
  9.  
  10. print(arr)
  11.  
  12.  
  13. # Второй вариант
  14.  
  15. arr = [2, 4, 5, 6, 7.3, 5.2]
  16.  
  17. convert_to_int = [int(x) for x in arr]
  18.  
  19. print(convert_to_int)
RAW Paste Data