Sample Page

This is an example page. It’s different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:

 

Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)

…or something like this:


# Sport Competition Software

# Define the categories and their criteria: Age, Weight and Experience. Create a list of athletes for each category, with their name and respective criteria values.
age_category = [(‘Alice’, 25), (‘Bob’, 30), (‘Charlie’, 22), (‘Dave’, 35), (‘Eve’, 28)]
weight_category = [(‘Alice’, 70), (‘Bob’, 80), (‘Charlie’, 75), (‘Dave’, 85), (‘Eve’, 65)]
experience_category = [(‘Alice’, ‘Beginner’), (‘Bob’, ‘Advanced’), (‘Charlie’, ‘Beginner’), (‘Dave’, ‘Expert’), (‘Eve’, ‘Advanced’)]

# Sort the list of athletes in each category based on their criteria values, using a stable sorting algorithm.
age_category = sorted(age_category, key=lambda x: x[1], reverse=True)
weight_category = sorted(weight_category, key=lambda x: x[1], reverse=True)
experience_category = sorted(experience_category, key=lambda x: x[1])

# Divide the sorted list of athletes in each category into pairs of two, starting from the top of the list. If there is an odd number of athletes, leave the last athlete unpaired for the next round.
def pair_athletes(category):
pairs = []
for i in range(0, len(category), 2):
if i+1 < len(category):
pairs.append((category[i][0], category[i+1][0]))
else:
unpaired = category[i]
return pairs, unpaired

age_pairs, age_unpaired = pair_athletes(age_category)
weight_pairs, weight_unpaired = pair_athletes(weight_category)
experience_pairs, experience_unpaired = pair_athletes(experience_category)

# Store the pairings for each round in a data structure, along with the round number and the remaining unpaired athletes (if any).
pairings = []
round_num = 1
while age_pairs:
round_pairings = {‘Round’: round_num, ‘Age’: age_pairs, ‘Weight’: weight_pairs, ‘Experience’: experience_pairs, ‘Age unpaired’: age_unpaired, ‘Weight unpaired’: weight_unpaired, ‘Experience unpaired’: experience_unpaired}
pairings.append(round_pairings)
round_num += 1

age_category = age_pairs + [age_unpaired]
weight_category = weight_pairs + [weight_unpaired]
experience_category = experience_pairs + [experience_unpaired]

age_category = sorted(age_category, key=lambda x: x[1], reverse=True)
weight_category = sorted(weight_category, key=lambda x: x[1], reverse=True)
experience_category = sorted(experience_category, key=lambda x: x[1])

age_pairs, age_unpaired = pair_athletes(age_category)
weight_pairs, weight_unpaired = pair_athletes(weight_category)
experience_pairs, experience_unpaired = pair_athletes(experience_category)

# Output the pairings for each round, along with the round number and the remaining unpaired athletes (if any).
for pairing in pairings:
print(f”Round {pairing[‘Round’]}:”)
print(f”Age pairs: {pairing[‘Age’]}”)
print(f”Weight pairs: {pairing[‘Weight’]}”)
print(f”Experience pairs: {pairing[‘Experience’]}”)
if pairing[‘Age unpaired’]:
print(f”Unpaired in age category: {pairing[‘Age unpaired’]}”)
if pairing[‘Weight unpaired’]:
print(f”Unpaired in weight category:

Sari la conținut