Python Program: Retrieving Follower Count and Displaying Person Details Returns None

29 Views Asked by At
from game_data import data
from art import logo, vs
import random
print(logo)


person_one_list = []

person_two_list = []

person_first_followers = None
person_second_followers = None

def person_one():
    global person_first_followers

    # Select a random person from the data
    person = random.choice(data)
    person_one_list.append(person)  # Append the selected person to the list
    person['follower_count'] = person_first_followers  # Assign follower count

    # Print information about the selected person
    print(f"Compare A: {person['name']}, {person['description']}, from {person['country']}")
    print(f"Follower count inside person_one(): {person_first_followers}")


person_one()  # Now person_first_followers should have the correct value
print(f"Follower count outside person_one(): {person_first_followers}")

print(vs)

def person_two():
    """A function that generates a second random person and stores it into another list"""
    for person in range(1):
        person = random.choice(data)
        second_person = person_two_list.append(person)
        person_second_followers = person['follower_count']
        print(f"Against B: {person['name']}, {person['description']}, from {person['country']} ")


person_two()
print(person_second_followers)
choice = input("Who has more followers? Type 'A' or 'B' ")

This Python program aims to randomly select a person from a dataset and display their details, including their name, description, and country. Additionally, it retrieves the follower count of the selected person and assigns it to another value,however everytime I print the variable it returns none.`

0

There are 0 best solutions below