day 14
import art
import game_data
import random
# print(game_data.data)
# print(art.logo)
title = art.logo
middle = art.vs
database = game_data.data
def choose_item():
item = random.choice(database)
que = ': {}, {}, {}'.format(item['name'], item['description'], item['country'])
ans = item['follower_count']
return que, ans
check_answer = True
compare_AQ, compare_AA = choose_item()
ans = ''
compare_BQ, compare_BA = choose_item()
# while check_answer:
# print(title)
# compare_A = choose_item()
# print("Compare A: {}, {}, {}".format(compare_A['name'], compare_A['description'], compare_A['country']))
# print('')
# print()
# compare_AQ, compare_AA = choose_item()
# print(compare_AQ)
# print(compare_AA)
# compare_BQ, compare_BA = choose_item()
# print(compare_BQ)
# print(compare_BA)
def check(A, B, inputans):
if inputans.upper() == 'A' and A > B:
return True
if inputans.upper() == 'B' and A < B:
return True
# inputans = input('Who has more followers? Type "A" or "B": ')
# A = compare_AA
# B = compare_BA
# check(A, B, inputans)
def game():
score = 0
print(title)
if score > 0:
print('You are right! Current score: {}'.format(score))
flag = True
while flag:
if score > 0:
print('You are right! Current scoree: {}'.format(score))
compareB = choose_item()
compareA = ''
if not compareA or compareB == compareB:
compareA = compareB
compareB = choose_item()
print('CompareA', compareA[0])
print(compareA[1])
print(middle)
print('CompareB', compareB[0])
print(compareB[1])
inputans = input('Who has more followers? Type "A" or "B": ')
A = compareA[1]
B = compareB[1]
if (inputans.upper() == 'A' and A > B) or (inputans.upper() == 'B' and B > A):
score += 1
compareA = compareB
else:
print('You got wrong, Final score: {}'.format(score))
flag = False
game()