+ 1

How to create a python function that automatically creates objects, only difference is the object name ending in different num?

5th May 2022, 1:28 PM
Yonatan
8 Answers
+ 2
Can you give me an example?
5th May 2022, 2:53 PM
Yonatan
+ 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?
5th May 2022, 1:53 PM
Yonatan
5th May 2022, 8:43 PM
JaScript
JaScript - avatar
0
what do you mean by "objects"?
5th May 2022, 1:38 PM
Slick
Slick - avatar
0
What kind of objects? And what do you mean by "automatically"? Please give some examples.
5th May 2022, 1:39 PM
Lisa
Lisa - avatar
0
Why don't you put the "objects" in a list?
5th May 2022, 2:26 PM
Lisa
Lisa - avatar
0
guest = [] guests.append(Guest("Anna"))
5th May 2022, 2:54 PM
Lisa
Lisa - avatar
0
That's great, I'll try that. Thanks!
5th May 2022, 3:02 PM
Yonatan