I am trying this beginner project of Higher Lower game. I pretty much got already 99% of the game's logic. The only thing I couldn't figure out is to keep the logo and vs stay in place while choice B keeps replacing choice A, then B picks randomly again.
Meaning:
"""LOGO""" (I want this to stay and not move/change)
Random pick here (while this would keep changing)
"""VS""" (I want this to stay and not move/change)
Random pick here (while this would keep changing)
Thanks in advanced.
Meaning:
"""LOGO""" (I want this to stay and not move/change)
Random pick here (while this would keep changing)
"""VS""" (I want this to stay and not move/change)
Random pick here (while this would keep changing)
Thanks in advanced.
def play_again():
#Choice A
a_compare = random.choice(data)
a_followers = a_compare['follower_count']
#########################################
#Choice B
b_compare = random.choice(data)
b_followers = b_compare['follower_count']
#########################################
score = 0
correct_answer = True
# print(logo)
# print(a_compare)
# print(vs)
# print(b_compare)
while correct_answer:
print(logo)
print(a_compare)
print(vs)
print(b_compare)
guess = input("Who has more followers. A or B: ").lower()
if guess == 'a':
if a_followers > b_followers:
#Keep track of player's score.
score += 1
print(f"Correct! Your current score is {score}\n")
#########################################
#This code is for B to keep replacing A as long as guess is correct.
a_compare = b_compare
a_followers = b_followers
###################################
#This code is for B to keep randomly choosing as long as guess is right.
b_compare = random.choice(data)
b_followers = b_compare['follower_count']
###################################
else:
correct_answer = False
print(f"Sorry, that's wrong. Your final score is {score}")
keep_playing()
if guess == 'b':
if b_followers > a_followers:
#Keep track of player's score.
score += 1
print(f"Correct! Your current score is {score}\n")
#########################################
#This code is for B to keep replacing A as long as guess is correct.
a_compare = b_compare
a_followers = b_followers
###################################
#This code is for B to keep randomly choosing as long as guess is right.
b_compare = random.choice(data)
b_followers = b_compare['follower_count']
###################################
else:
correct_answer = False
print(f"Sorry, that's wrong. Your final score is {score}")
keep_playing()
play_again()
