Python Forum

Full Version: Why do I get Syntax error?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
#getpass will hide what the person is typing during the password
import getpass

def new_entry():
  #input the username and password and the website
  Website = str(input("Enter the website: "))
  Username = str(input("Enter the username: "))
  Password = getpass.getpass()

#Menu to choose if you want to add, see or remove
print("  *************************")
print(" /$$   /$$ /$$$$$$ /$$$$$$$ \n| $$  | $$|_  $$_/| $$__  $$\n| $$  | $$  | $$  | $$  \ $$\n| $$$$$$$$  | $$  | $$  | $$\n| $$__  $$  | $$  | $$  | $$\n| $$  | $$  | $$  | $$  | $$\n| $$  | $$ /$$$$$$| $$$$$$$/\n|__/  |__/|______/|_______/ ")
print("**************************")
print ("1. See the list\n2. Add new entry")
choice = (input("")
if (choice) == (2):
  new_entry()
  #if you select option 2 it will call the new_entry code
else:
  choice = (input("ERROR\nInvalid input: Please type agian\n")
#Store this somewhere
So I get a syntax error on my if statement and I don't know why and if there is any why to improve this please tell me, I am trying to make a password saver.
When get syntax error and can not see it on line it point to,look at line before.
So line in line 15 and 20 is missing one ) at end.

input() is returning a string so no need for str
Only in want int or float then use it like this int(input("Enter a number ")).
website = input("Enter the website: ")