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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
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() |