Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
981 B
2
Indexable
Never
from random import randint
from art import logo, vs
from game_data import data


first_random_index = randint(0, len(data) - 1)
A = data[first_random_index]
second_random_index = randint(0, len(data) - 1)
if first_random_index != second_random_index:
    B = data[second_random_index]

def game_opening(A, B):
    print(f"Compare A: {A['name']}, a {A['description']}, from {A['country']}.")
    print(vs)
    print(f"Against B: {B['name']}, a {B['description']}, from {B['country']}.")


def compare(guess):
    if A['follower_count'] > B['follower_count']:
        return guess == 'A'
    else:
        return guess == 'B'

print(logo)
game_opening(A, B)
score = 0
while compare(input("Who has more followers? Type A or B: ").upper()) == True:
    score += 1
    print(f"You're right! Current score: {score}")
    A = B
    B = data[randint(0, 49)]
    while A == B:
        B = data[randint(0, 49)]
    game_opening(A, B)

print(f"Sorry, that's wrong. Final score: {score}")