0
import random

CorrectResponces = ['Congrats', 'Good Job', 'You got it', "You're on fire"]

IncorrectResponces = ['Better luck next itme', 'Think a little harder',
                      'Wow are you stupid', 'How did you get this one wrong']

FinalResponces = ["You wouldn't even be able to get participation points", 'You are really really bad at this',
                  "You didn't do absolutely terrible but not good either", "Good enough job ig"]

def True_Or_False():

    i = 1
    CorrectVal = 0
    WrongVal = 0

    Start = input('Enter "START" to begin =>')
    if Start == "START":

        while i <= 3:

            VGQuestions = random.randint(1, 3)

            if VGQuestions == 1:
                Answer = input(
                    '"The Legend of Zelda Breath of the Wild" Released in 2017 =>')
                i = i + 1
                if Answer == 'TRUE':
                    print(random.choice(CorrectResponces))
                    CorrectVal = CorrectVal + 1
                elif Answer == 'FALSE':
                    print(random.choice(IncorrectResponces))
                    WrongVal = WrongVal + 1
                else:
                    print('Please enter "TRUE" or "FALSE"')

            if VGQuestions == 2:
                Answer = input(
                    '"Super Smash Bros Ultimate" has over 100 playable characters =>')
                i = i + 1
                if Answer == 'FALSE':
                    print(random.choice(CorrectResponces))
                    CorrectVal = CorrectVal + 1
                elif Answer == 'TRUE':
                    print(random.choice(IncorrectResponces))
                    WrongVal = WrongVal + 1
                else:
                    print('Please enter "TRUE" or "FALSE"')

            if VGQuestions == 3:
                Answer = input(
                    'There are over 500 obtainable pokemon across all the games as of 2023 =>')
                i = i + 1
                if Answer == 'TRUE':
                    print(random.choice(CorrectResponces))
                    CorrectVal = CorrectVal + 1
                elif Answer == 'FALSE':
                    print(random.choice(IncorrectResponces))
                    WrongVal = WrongVal + 1

        if WrongVal == 3:
            print(FinalResponces[0])
        elif WrongVal == 2:
            print(FinalResponces[1])
        elif WrongVal == 1:
            print(FinalResponces[2])
        elif WrongVal == 0:
            print(FinalResponces[3])

        FinalScore = f'Correct {CorrectVal}; Wrong {WrongVal}'
        print(FinalScore)

    else:
        print('Please type "START" to begin')
        True_Or_False()


True_Or_False()

I would like the boolean to loop when 'TRUE' or 'FALSE' aren't inputed. I tired putting that portion of the code in a function then declaring the function after else but it wasnt working.

M Z
  • 4,571
  • 2
  • 13
  • 27
AquaZ5
  • 1
  • Hey, welcome to SO! maybe the code review stack exchange will be able to provide you with better help – M Z Apr 28 '23 at 01:10

1 Answers1

0
import random
CorrectVal = 0
WrongVal = 0

CorrectResponces = ['Congrats', 'Good Job', 'You got it', "You're on fire"]

IncorrectResponces = ['Better luck next itme', 'Think a little harder', 'Wow are you stupid', 'How did you get this one wrong']

FinalResponces = ["You wouldn't even be able to get participation points", 'You are really really bad at this', "You didn't do absolutely terrible but not good either", "Good enough job ig"]

def logic(i):
    
    global CorrectVal
    global WrongVal
    global VGQuestions
    global CorrectResponces
    global IncorrectResponces
    global FinalResponces
    
    if VGQuestions == 1:
        Answer = input(
            '"The Legend of Zelda Breath of the Wild" Released in 2017 =>')
        i = i + 1
        if Answer == 'TRUE':
            print(random.choice(CorrectResponces))
            CorrectVal = CorrectVal + 1
        elif Answer == 'FALSE':
            print(random.choice(IncorrectResponces))
            WrongVal = WrongVal + 1
        else:
            print('Please enter "TRUE" or "FALSE"')
        
i = 1

Start = input('Enter "START" to begin =>')
if Start == "START":

    while i <= 3:

        VGQuestions = random.randint(1, 3)

        if VGQuestions == 1:
            logic(1)

        if VGQuestions == 2:
            logic(2)

        if VGQuestions == 3:
            logic(3)

    if WrongVal == 3:
        print(FinalResponces[0])
    elif WrongVal == 2:
        print(FinalResponces[1])
    elif WrongVal == 1:
        print(FinalResponces[2])
    elif WrongVal == 0:
        print(FinalResponces[3])

    FinalScore = f'Correct {CorrectVal}; Wrong {WrongVal}'
    print(FinalScore)

else:
    print('Please type "START" to begin')
    True_Or_False()
  • While this code may solve the question, [including an explanation](https://meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add an explanation. – Nick Apr 28 '23 at 01:46