Python 102

range, min, max, sum, slice!
## Learning range
for val in range(5): ## 5 not inclusive!
    print(val, end = ' ') ## 0 1 2 3 4 
 
print("")
 
## Starting from a specific value instead of 0
for val in range(4, 5): ## 4 is inslusive, 5 is not!
    print(val, end = ' ') ## 4
 
print("")
 
## List of numbers from range:
my_list_of_numbers = list(range(0, 11))
print(my_list_of_numbers) ## [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 
## Finding minimum, maximum and sum:
print(min(my_list_of_numbers)) ## 0
print(max(my_list_of_numbers)) ## 10 
print(sum(my_list_of_numbers)) ## 55
 
## Increment by a specific value instead of 1
odd_nums_in_range = list(range(1, 21, 2))
print(odd_nums_in_range) ## 1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
 
## slice
players = ["foo", "bar", "baz", "quax"]
print(players[1:3]) ## ['bar', 'baz']
 
## copying a list
players_copied = players[:]
print(players_copied) ## ['foo', 'bar', 'baz', 'quax']