Untitled

 avatar
user_7491862
plain_text
2 years ago
3.1 kB
4
Indexable
// write your code import random

# Define the qualities and their weights
qualities = [
    { 'name': 'kindness', 'weight': 0.2 },
    { 'name': 'generosity', 'weight': 0.15 },
    { 'name': 'empathy', 'weight': 0.25 },
    { 'name': 'integrity', 'weight': 0.3 },
    { 'name': 'resilience', 'weight': 0.1 },
    { 'name': 'altruism', 'weight': 0.2 },
    { 'name': 'genuineness', 'weight': 0.2 },
    { 'name': 'crudeAndCallous', 'weight': 0.1 },
    { 'name': 'forgetfulness', 'weight': 0.1 },
    { 'name': 'selfishness', 'weight': 0.1 },
    { 'name': 'impactOnOthers', 'weight': 0.3 }
]

# Define the desires and their weights
desires = [
    { 'name': 'love', 'weight': 0.25 },
    { 'name': 'achievement', 'weight': 0.2 },
    { 'name': 'freedom', 'weight': 0.15 },
    { 'name': 'adventure', 'weight': 0.1 },
    { 'name': 'security', 'weight': 0.2 },
    { 'name': 'creativity', 'weight': 0.15 },
    { 'name': 'knowledge', 'weight': 0.15 }
]

# Define the likes and their weights
likes = [
    { 'name': 'music', 'weight': 0.15 },
    { 'name': 'nature', 'weight': 0.12 },
    { 'name': 'art', 'weight': 0.1 },
    { 'name': 'sports', 'weight': 0.08 },
    { 'name': 'books', 'weight': 0.1 },
    { 'name': 'travel', 'weight': 0.12 },
    { 'name': 'food', 'weight': 0.1 },
    { 'name': 'technology', 'weight': 0.1 },
    { 'name': 'animals', 'weight': 0.13 },
    { 'name': 'movies', 'weight': 0.1 }
]

# Define the dislikes and their weights
dislikes = [
    { 'name': 'rudeness', 'weight': 0.15 },
    { 'name': 'inequality', 'weight': 0.1 },
    { 'name': 'injustice', 'weight': 0.13 },
    { 'name': 'dishonesty', 'weight': 0.12 },
    { 'name': 'violence', 'weight': 0.1 },
    { 'name': 'pollution', 'weight': 0.1 },
    { 'name': 'discrimination', 'weight': 0.1 },
    { 'name': 'negativity', 'weight': 0.1 },
    { 'name': 'ignorance', 'weight': 0.1 },
    { 'name': 'greed', 'weight': 0.12 }
]

# Function to determine someone's character score
def determine_character_score():
    total_score = 0

    # Calculate the score for qualities
    for quality in qualities:
        score = get_random_score()
        weighted_score = score * quality['weight']
        total_score += weighted_score

    # Calculate the score for desires
    for desire in desires:
        score = get_random_score()
        weighted_score = score * desire['weight']
        total_score += weighted_score

    # Calculate the score for likes
    for like in likes:
        score = get_random_score()
        weighted_score = score * like['weight']
        total_score += weighted_score

    # Calculate the score for dislikes
    for dislike in dislikes:
        score = get_random_score()
        weighted_score = score * dislike['weight']
        total_score -= weighted_score

    # Return the character score
    return round(total_score, 2)

# Function to generate a random score between 0 and 100
def get_random_score():
    return random.uniform(0, 100)

# Call the function to determine someone's character score
character_score = determine_character_score()

# Output the character score
print('Character Score:', character_score)
Editor is loading...