this is the code i used in the LibraryCustomers.py module:
class Customer:
"""
A class that represents the Customer object
"""
def __init__(self,customer_id,customer_name,customer_city,customer_age):
"""
A function that contains all the relevant information of customers
:param customer_id: Customer's ID
:param customer_name: Customer's name
:param customer_city: Customer's city of living
:param customer_age: Customer's age'
"""
self.customer_id = customer_id
self.customer_name = customer_name
self.customer_city = customer_city
self.customer_age = customer_age
def add_new_customer(self,customer_id, customer_name, customer_city, customer_age):
"""
A function that add new customer to the Library
:param customer_id: Customer's ID'
:param customer_name: Customer's name'
:param customer_city: Customer's city'
:param customer_age: Customer's age'
"""
new_customer = {'customer id':{customer_id}, 'customer name':{customer_name}, 'customer city':{customer_city}, 'customer age':{customer_age}}
return new_customer
this is the code i used in the main.py: Adding a new customer (based on the input)
customer_id_input = input("Enter customer's ID: ")
" adding customer id "
customer_name_input = input("Enter customer's name: ")
" adding customer name"
customer_city_input = input("Enter customer's city: ")
" adding customer city"
customer_age_input = input("Enter customer's age: ")
" adding customer age"
new_customers = Customer.add_new_customer(customers_library,customer_id_input,customer_name_input,customer_city_input,customer_age_input)
customers_library.update(new_customers)
# updated_customers_library = json.dumps(customers_library)
print("Added customer...")
print("Done!, Customer added successfully")
print(f"\n{customers_library}")
every time i run this code it doesn't add the new customer to the customers dict in the main.py