human
Write me a Python program to sort data by variable.
assistant
Here is a Python program to sort data by variable

import random

def sort_data_by_variable(data, variable):
    """Sort data by variable."""
    return sorted(data, key=lambda x: x[variable])

# Enter the data
data = [(random.randint(0, 100), random.randint(0, 100)) for _ in range(10)]

# Enter the variable
variable = 0

# Calling the function
print((sort_data_by_variable(data, variable)))

#Example Output
# [(12, 100), (27, 52), (42, 13), (50, 19), (64, 87), (66, 90), (74, 98), (80, 48), (87, 26), (96, 51)]

#Remember to inspect code for bugs.