0

I’m trying to use an if statement to determine if a certain text is in the input and that used to work fine until I used input random and now my if statement is returning a syntax error.

command_1=input()

post_type_fg="/post-fg"
post_type_ot="/post-ot"
post_type_sb="/post-sb"
post_type_gh="/post-gh"
post_type_hym="/post-hym"

import random
post_post_count= random.randint(1,10)
temp_post_like_count= random.randint(0,((post_post_count * 2))




if  post_type_fg in command_1:
        print("You posted",command_1[8:],"in the section forum games")
        print("Post Count:", post_post_count)
        print("Like Count: (", post_like_count, "*")

else: 
    
    print("error command 1")

1 Answer 1

1

Problem is caused by previous line, i.e.:

temp_post_like_count= random.randint(0,((post_post_count * 2))

you have unbalanced brackets (more ( than )). If you got SyntaxError but pointed line does not show any error then there is good chance, that problem is actually in previous line.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.