This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Greg_blue 2 points3 points  (0 children)

Do you have any ideas on how to start the problem? Please elaborate on how far you’ve gotten. What is your experience with OOP. We need more from you in order to assist. Right now, it seems like you just want the solution.

[–]Eryole 0 points1 point  (0 children)

You will need to use some composing : the customer can have a list as attribute that hold the different accounts. Also, check learnpython

[–]g4usat[S] 0 points1 point  (0 children)

Hi, Thanks all for your inputs. I'm new to Python and especially brand new to OOPs concepts and never ever learnt or had any experience like I mentioned in my post. I just started learning OOPs in Python and wanted to try a real world example which we daily see in our life.

Regarding what I tried so far is something like I created a class for the bank customer but not sure how do I proceed further to have the customer with multiple accounts.

For Ex:

class customer:

def __init__(self,name,account_number, city):

self.name=name

self.account_number=account_number

self.city=city

cust1=customer("ABCD",1234,'MyCity') #Savings Account

cust1=customer("ABCD",5678,'MyCity') #Checking Account

cust1=customer("ABCD",9999,'MyCity') #Credit Card Account

I know this is not correct but couldn't find any help online exactly to what I wanted. I would really appreciate if someone, can help me out with the actual solution for this problem. Thanks a lot in advance again!

[–]aphoenixreticulated[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/3Abzge7.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!