Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Syntax Error While Creating Object [Python 3.6.1]

Good day, everyone.
Trying to get more experience with OOP in Python. It seemed very familiar to most languages, but after trying to get more practice with it now I'm not so sure anymore.

Code
import urllib2
import sys

class Account:

    entry_commands = ["register", "login", "exit"]
    account_commands = ["view_details", "edit_details", "logout"]
    admin_commands = ["delete_user", "view_user_details"]
    misc_commands = ["promote", "demote", "clear_user_details", "clear_everyone"]

    #def generate_id(self):


    def register_user(self, name, password, date_of_birth, sex):
        print("Lmao")

    def __init__(self):
      print("Welcome to the login")
      for com in self.member.commands:
          print("[%s] %s" %(self.member.commands.index(com), com


JuiceWater = Account()

Code
JuiceWater = Account()
             ^
SyntaxError: invalid syntax

Code
E0001:invalid syntax (<string>, line 23)


I get an error at when trying to initialize JuiceWater. It says invalid syntax, but this is the way I've been creating objects for days. Does anyone know why I'm not able to create Account objects, or am I just a dumbass for not seeing the obvious?

Any explanations would be much appreciated. 🤝
You are missing your closing brackets on line 20.
PHP Code

<?php 
print("[%s] %s" %(self.member.commands.index(com), com)) 
[Image: npafFhp.gif]
(Jul 11, 2017 05:26 PM)Retribute Wrote:  You are missing your closing brackets on line 20.
PHP Code

<?php 
print("[%s] %s" %(self.member.commands.index(com), com)) 

I'm an idiot. Thanks a lot.🤝


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by Poojar102Nov 1, 2021 10:32 AM 4 185 Nov 1, 2021 10:32 AM
Last Post: Maquina
[Python] by simmerJul 30, 2021 10:08 AM 7 231 Jul 30, 2021 10:08 AM
Last Post: simmer