+ 1
How to create a python function that automatically creates objects, only difference is the object name ending in different num?
8 Antworten
+ 2
Can you give me an example?
+ 1
I want to create a little python program that I give it an input for how many guests I have for -let's say for the example- a wedding.
I want the program to make all the seating arrangements, according to the following variables: number of guests, number of tables and how many people fit in each table (which is the part I am using a class called 'table'), and restrictions of what people cannot sit at the same table (they hate each other), and all families sit together
Is that clear?
+ 1
How about this:
https://code.sololearn.com/c2FO0lXu95Hg/?ref=app
0
what do you mean by "objects"?
0
What kind of objects?
And what do you mean by "automatically"?
Please give some examples.
0
Why don't you put the "objects" in a list?
0
guest = []
guests.append(Guest("Anna"))
0
That's great, I'll try that. Thanks!