Home > OS >  how to fix syntax error while if...else statement?
how to fix syntax error while if...else statement?

Time:07-15

import webbrowser
Character_Name = "Random"
Character_Age = "14"

input("Name of the person you want the ID of.")
print("Here's The Information That I Have: Name:"   Character_Name   ", Age:"   Character_Age   ", Available socialmedia accounts: (insta) www.instagram.com/asenpai369")

a = input("Should i open the link in your web browser?")

if a : "Yes"
webbrowser.open("www.instagram.com/idksoumyadeep")

else:
print("okay, if its a mistype then please type it again")

and the error

        else:
    ^
SyntaxError: invalid syntax

please help thanks in advance :))

CodePudding user response:

It should be

if a == "Yes": webbrowser.open("www.instagram.com/idksoumyadeep")
else: print("okay, if its a mistype then please type it again")

CodePudding user response:

Use indentation after the if and else:

import webbrowser
Character_Name = "Random"
Character_Age = "14"

input("Name of the person you want the ID of.")
print("Here's The Information That I Have: Name:"   Character_Name   ", Age:"   Character_Age   ", Available socialmedia accounts: (insta) www.instagram.com/asenpai369")

a = input("Should i open the link in your web browser?")

if a == "Yes":
    webbrowser.open("www.instagram.com/idksoumyadeep")

else:
    print("okay, if its a mistype then please type it again")
  • Related