Untitled
import art import game_data import random def person_data(list): person_information = random.choice(list) return person_information def print_message(person_info_list): return f"{person_info_list["name"]} a {person_info_list["description"]}, from {person_info_list["country"]}" def compare_answer(a_follower_count, b_follower_count, user_answer): global score global good_answer if user_answer == "a": if a_follower_count > b_follower_count: score += 1 return f"\nYou're right! Current score: {score}." else: good_answer = False return f"\nSorry, that's wrong. Final score: {score}" elif user_answer == "b": if b_follower_count > a_follower_count: score += 1 return f"\nYou're right! Current score: {score}." else: good_answer = False return f"\nSorry, that's wrong. Final score: {score}" score = 0 good_answer = True def game(): print(art.logo) a_comparison = person_data(game_data.data) a_followers = a_comparison["follower_count"] while good_answer: b_comparison = person_data(game_data.data) b_followers = b_comparison["follower_count"] print(f"Compare A: {print_message(a_comparison)}") print(f"{art.vs}") print(f"Against B: {print_message(b_comparison)}") player_answer = input("Who has more followers? Type 'A' or 'B': ").lower() print(compare_answer(a_followers, b_followers, player_answer)) a_comparison = b_comparison a_followers = b_followers game()
Leave a Comment