Я создал это терминальное приложение некоторое время go, и оно работало, но я некоторое время не трогал, и я просто открыл его обратно, и я не могу понять, что это за ошибка и почему я ' У меня это есть. Это происходит во время создания учетной записи в моей программе. Я попробовал пару вещей, но я все еще не уверен, что происходит.
**TypeError: CreateAccount() missing 1 required positional argument**
main.py
from Account import Account
from Transaction import Transaction
from enum import Enum
from fcp import CreateAccount
#variables and lists needed for program
new_accounts = []
#do no tneed, just put the balance of 0 straight into the factory class attribute
#balance = 0
user_name = []
Transactions = []
account_number = 0
#***Functions for switch statements***
def create_user():
global new_accounts
global account_number
active_create_account = False
new_username = input("\n\nCreate a username:")
email = input("Write your email: ")
account_number +=1
print(account_number)
# append the createaccount call straight into new_accounts.append
new_accounts.append(CreateAccount(user_name,email, int(input('Choose 1 for Checkings or 2 for Savings: ')), 0, 0))
active_create_account = True
for i in new_accounts:
if account_number == i.account_number:
i.new_account_creation()
account_search_balance = True
if account_search_balance == False:
print("\nThat account does not exist. Please re-enter option 5 and try again.")
main()
fcp.py
from Account import Account
from Transaction import Transaction
#BLANK CLASS TEMPLATE
def CreateAccount(self,user_name,email,account_type,balance,account_number):
account_number +=1
if (account_type == 1): return CreateCheckingAccount(user_name,email,1,balance,account_number)
if (account_type == 2): return CreateSavingsAccount(user_name,email,2,balance,account_number)
else:
return CreatAccount(user_name,email, int(input('Choose 1 for Checkings or 2 for Savings: ')),balance,account_number)
def CreateCheckingAccount(self,user_name,email,account_type,balance,account_number):
return Account(user_name, email,'Checking',balance,account_number)
def CreateSavingsAccount(self,user_name,email,account_type,balance,account_number):
return Account(user_name, email,'Savings',balance,account_number)
транзакция. py
import datetime
class Transaction():
def __init__(self,account_number,type_of_transaction,old_balance,new_balance,date = datetime.datetime.now()):
self.account_number = account_number
self.type_of_transaction = type_of_transaction
self.old_balance = old_balance
self.new_balance = new_balance
self.date = datetime.datetime.now()
def to_string(self):
print("\nThe account number is: " + str(self.account_number) + "\nThe type of transaction is: " + self.type_of_transaction + "\nThe old balance was: " + str(self.old_balance) + "\nThe new balance is: " + str(self.new_balance) + "\nThe date of the transaction was: " + str(self.date))
def print_date(self):
print(str(self.date))
Account.py
class Account(object):
def __init__(self,user_name,email,account_type,balance,account_number):
self.user_name = user_name
self.email = email
self.account_type = account_type
self.balance = balance
self.account_number = account_number
def print_balance(self):
print("\nAccount bala is "+ str(self.balance))
return
def new_balance(self):
print("\nThe new account balance is: " + str(self.balance))
def to_string(self):
print("\nUsername: " + self.user_name + "\n\nEmail: " + self.email + "\n\nAccount type: " + (self.account_type) +
"\n\nYour account balance is:" + str(self.balance) +"\n\nAccount number: " + (self.account_number))
def new_account_creation(self):
print("\nCongragulations on your new account! Below is the info:\nUsername: " + self.user_name + "\nEmail: " + self.email + "\nAccount type: " + self.account_type +
"\nYour account balance is:" + str(self.balance) +"\nAccount number: " + str(self.account_number)+ " <--- Do NOT forget this number")
def Deposit(self):
deposit = int(input("\nHow much would you like to deposit?: "))
self.balance += deposit
def withdraw(self,withdraw):
self.balance -= withdraw