# lets make a program that has people invited to our birthday
# party!
# But UH OH!, our birthday part table only has enough room for
# 6 people,
Our_table = ["george","samantha",
"kris","webster",
"harold","john",
"miles","hamilton","dog"]
def uninvited_statement(name):
print(f"Dear {name},\n\tIt has been an unfortunate decision to inform you; {name}, you have been uninvited from our birthday party to be hosted on 1/13/25. We have made the mistake of adding more than 6 people to our birthday party. Here's a $5 Amazon gift card as an apology.\n")
while len(Our_table) > 7-1:
uninvited = Our_table.pop()
uninvited_statement(uninvited)
#๐ Ive made a birthday party program
24 messages ยท Page 1 of 1 (latest)
@stuck haven
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
What's the problem
Not the dog 
replace 7-1 with 6 in the code
ok
Mb, instead of printing that thing just return it
New and updated code:
# lets make a program that has people invited to our birthday
# party!
# But UH OH!, our birthday part table only has enough room for
# 6 people,
Our_table = ["george","samantha",
"kris","webster",
"harold","john",
"miles","hamilton",
"dog","Charles"]
def still_invited(name):
return(f"Dear {name},\n\tWe have made some changes to whom is still remaining in our party. We have made unfortunatly removed some people from our party, However, you; {name} are still invited to our birthday party in which will be hosted on 1/13/25.\n")
def uninvited_statement(name):
return(f"Dear {name},\n\tIt has been an unfortunate decision to inform you; {name}, you have been uninvited from our birthday party to be hosted on 1/13/25. We have made the mistake of adding more than 6 people to our birthday party. Here's a $5 Amazon gift card as an apology.\n")
while len(Our_table) > 6:
uninvited = Our_table.pop()
print(uninvited_statement(uninvited))
for person in Our_table:
print(still_invited(person))
if you want to play around more with this. you could try implementing a priority for each invited person and remove the person with the least priority. this can be done with a heap. implementing a own class for a heap could also be a nice task but there is already an implementation for heaps in the module heapq
@stuck haven
That print after the while loop should be indented no?
print(uninvited_statement(uninvited))?
I believe that will create an unexpected indentation error
Why does mobile do that?
Its wrapping lines that are too long
Heres what It should look like
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.