Absolute beginner to Python and programming, I am trying to create a program where the user can add meetings and store them, kind of like a calendar.
When doing this, I've created a class Meetings, with 4 parameters (name, start_time, end_time, link)
class Meeting:
def __init__(self, name, start_time, end_time, link):
self.name = name
self.start_time = start_time
self.end_time = end_time
self.link = link
In the app.py file I typed this:
from Meeting import Meeting
def meetings_count(meeting_count1):
meeting_count1 += 1
return meeting_count1
def ask_meeting(meeting_count2):
answer = input("Do you want to add a new meeting?: ")
if answer == "yes":
meeting_count2 = meetings_count(meeting_count2)
print("Number of meetings: " + str(meeting_count2))
name = input("\nName: ")
start_time = input("Start time: ")
end_time = input("End time: ")
link = input("Link: ")
add_meeting(name, start_time, end_time, link, meeting_count2)
def add_meeting(name1, start_time1, end_time1, link1, meeting_count3):
# code that creates something like this but instead of the line bellow,
Meeting1 = Meeting(name1, start_time1, end_time1, link1)
# creates an object named "Meeting" + meeting_count3
# if that is possible, then I can store different meetings(in the form of objects)
print("\n" + Meeting1.name)
print(Meeting1.start_time)
print(Meeting1.end_time)
print(Meeting1.link + "\n")
print("Number of meetings: " + str(meeting_count3) + "\n")
ask_meeting(meeting_count3)
meeting_count = 0
ask_meeting(meeting_count)
I've watched all over the web for "Variable variables" and "Dictionary usage", but it is just confusing me all over because the projects have a much higher level of complexity.
EDIT: To clarify, I do know what lists and dictionaries are. My question is, when I create the first meeting, it is recognized as the object Meeting1, but when I try to create a second meeting, it will overwrite the first meeting. What I´d like to do is create objects of the class Meetings in a way that it equals:
Meeting(meeting_count) = Meeting(name1, start_time1, end_time1, link1)
This way, the first meeting created will be the object Meeting1, the second meeting will be the object Meeting2, etc.
EDIT2: After reading your answers, I´ve understood that such a program could be coded using lists instead of classes. Thank you all for the time and patience to deal with a fool like me :D
Thank you!