
a = [42, 23, 66, 42, 93, 47, 30]
b = 'dsf aaerwq dfasdf '
c = ('sdf', 'sdqwet', 'ghetrertg')

# метод .sort возвращает None
new_list = a
new_list = new_list.sort()
# print(new_list)

# Принимает любую итерабельную последовательность
# Не изменяет начальную коллекцию
# Возвращает список
sorted(a)


sorted_string = sorted(b, reverse=True)
sorted_tuple = sorted(c)

# print(sorted_string)
# print(sorted_tuple)
# print(sorted(a))


# Сортировка будет происходить по двум признакам последовательно
def foo(x):
	return x%10, x//10%10

# print(sorted(a, key=foo))


my_list_1 = ['ZZZ 5', 'aaa 7', 'BBB 23', 'www 45', 'EEE 5', 'ddd 5']

# print(sorted(my_list_1, key = str.lower))
# print(sorted(my_list_1, key = lambda x: (int(x.split()[1]), x.split()[0].lower() )))

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


# subject_marks = [('English', 88), ('Science', 90), ('Maths', 97), ('Physics', 93),('History', 82)]

subject_marks = [('English', 88), ('Science', 90), ('Maths', 88),
                 ('Physics', 93), ('History', 78), ('French', 78),
                 ('Art', 78), ('Chemistry', 88), ('Programming', 91)]

# subject_marks = sorted(subject_marks, key = lambda x: x[1])
# for key, value in subject_marks:
# 	print(key, value)


# subject_marks = sorted(subject_marks, key = lambda x: x[1], reverse=True)
# for key, value in subject_marks:
# 	print(key, value)


# subject_marks = sorted(subject_marks, key = lambda x: (-x[1], x[0]))
# for key, value in subject_marks:
# 	print(key, value)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

heroes = {
    'Spider-Man': 80,
    'Batman': 65,
    'Superman': 85,
    'Wonder Woman': 70,
    'Flash': 70,
    'Iron Man': 65,
    'Thor': 90,
    'Aquaman': 65,
    'Captain America': 65,
    'Hulk': 87,
}

