SyntaxError: invalid syntax // basball game is being made, but I don't know if there is a problem with the main function.

Asked 2 years ago, Updated 2 years ago, 77 views

def main(): print("Play Baseball")

random_number = str(get_not_duplicated_three_digit_number())

print("Random Number is : ", random_number)
user_input = '999'

while(get_strikes_or_ball(user_input, random_number) != [3, 0]):

    user_input = input("Input guess number : ")

    if user_input != '0':

            if is_validated_number(user_input) is True:
                get_strikes_or_ball(user_input, random_number)
                print("Strikes : " +
                str(get_strikes_or_ball(user_input, random_number)[0]) + " , " +
                "Balls : " + str(get_strikes_or_ball(user_input, random_number)[1]))
            else:
                print("Wrong Input, Input again")

    else:
        break

if user_input is not '0':
    one_more_input = 'Y'
    while(is_no(one_more_input)) is not True:
        one_more_input = input("You win, one more(Y/N) ?")

        if is_yes(one_more_input) is True:
            random_number = str(get_not_duplicated_three_digit_number())

            print("Random Number is : ", random_number)
            user_input = '999'

            while(get_strikes_or_ball(user_input, random_number) != [3, 0]):

                user_input = input("Input guess number : ")

                if user_input != '0':

                        if is_validated_number(user_input) is True:
                            get_strikes_or_ball(user_input, random_number)
                            print("Strikes : " +
                            str(get_strikes_or_ball(user_input, random_number)[0]) + " , " +
                            "Balls : " + str(get_strikes_or_ball(user_input, random_number)[1])
print("Thank you for using this program")
print("End of the Game")

if name == "main": main()

Here, SyntaxError: invalid syntax error appears in the last print statement and error appears in the t part.

baseball-game main syntax-error

2022-09-21 18:22

1 Answers

One of the brackets is missing.

print("Strikes : " +
str(get_strikes_or_ball(user_input, random_number)[0]) + " , " +
"Balls:" + str(get_strikes_or_ball(user_input, random_number)[1]) # <= Ends closing bracket ")"


2022-09-21 18:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.