i'm trying to make higher_lower game that let the user to guess between to celebrities i don't know what's the problem in my programme

Viewed 14

i think the problem is in loop i don't know the program is just stopped after the first round but it's only giving one result and the rest is jut keep repeating the same print statement and it's not giving a new random celebrity plus the score is always 1 or 0 #i don't know where the bug is but the

 a=random.choice(data)
    b=random.choice(data)
    value1=a["follower_count"]
    value2=b["follower_count"]
    nameA=a["name"]
    nameB=b["name"]
    descriptionA=a["description"]
    descriptionB=b["description"]
    countryA=a["country"]
    countryB=b["country"]
    score=0
    def compare_1(a,b):
        game_continue=True
        while game_continue:             
            a=b 
            b=random.choice(data)
            while a == b:
                b=random.choice(data)
                print(f"compare A: {nameA},a {descriptionA}, from {countryA}")
                print(vs)
                print(f"compare B: {nameB},a {descriptionB}, from {countryB}")
                answer_comp()
                #clear()            
                #print(logo)
        else:
            game_continue=False
            print(f"soory you loose : {score}")
    def answer_comp():
        global score
        answer=input("who has more followers  A or B ").lower()
        global value1
        global value2
        if answer=="a" and value1>value2:
                score+=1
                print(f"correct,move to the next one your score is:{score}")
                return a 
        elif answer=="b" and value1<value2:
              score+=1
              print(f"correct,move to the next one your score is:{score}")
              return b
        elif answer=="a" and value1<value2:
                print(f"faulse,you loose your score is :{score}")
               
                
        elif answer=="b"and value1>value2:
                 print(f"faulse,you loose your score is :{score}")  

  compare_1(a,b)
0 Answers
Related