Advertisement
Draqun

pa_lists_to_tuples

Nov 12th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. tuple_from_list = tuple([1, 2, 3, 4, 5])
  4.  
  5. print(tuple_from_list)
  6. print(type(tuple_from_list))
  7.  
  8. tuple2_from_list = tuple(list(range(1, 20, 2)))
  9.  
  10. print(tuple2_from_list)
  11. print(type(tuple2_from_list))
  12.  
  13. consts = list((0, 1, 1.41, 1.73, 2.23, 2.71, 3.14))
  14.  
  15. tuple_of_consts = tuple(consts)
  16. print(tuple_of_consts)
  17. print(type(tuple_of_consts))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement