#π Help with college assignment
127 messages Β· Page 1 of 1 (latest)
@quartz hare
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.
!rule 9
@slender badger you can help?
nobody knows cause no1 can tell tf ur issue is without looking at code
Well its alot to send here thats why im just looking for people. Im new here.
Its not just 1 file
And im not getting an error
@quartz hare We can't help for assignments that are related to your studies
we can just not ongoing exams
and we cant just give them the answer to hw
!rule exam
8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.
Not sure if you need any more files thats to do with this. But its not getting the list of applicants
Please react with β
to upload your file(s) to our paste bin, which is more accessible for some users.
and i cant proceed further
This is the function that isn't behaving as expected right?
its supposed to say applicants.json?
This is going to be hard to debug since I can't actually run the code (there are missing dependencies), but I will try my best
i can send the rest
what do you mean?
Please react with β
to upload your file(s) to our paste bin, which is more accessible for some users.
Please react with β
to upload your file(s) to our paste bin, which is more accessible for some users.
give me a moment to set up the files
!rule 9
It seems the code you posted has errors
There was a casting error in applicants.py which i fixed
But now the code is raising an InvalidApplicationException
I'm not familiar with your code so I don't know how to work around that
no problem, but is it printing applicants
or is it giving error and not printing applicants
this
hmm
Can you tell me which lines are okay to comment out
Any, you can try as I've backups to my original work. If you're willing to experiment
ok sounds good
I got it to work
Not sure if this will work for you but this is what I changed
Yes
hmm im still getting the same.
Are we running the same code??
are you maybe able to come vc?
no, sorry
can you maybe send the main.py and applicants here
maybe i wrote it in wrong
but i'd get an error
hmm
Click here to see this code in our pastebin.
from invalidapplicationexception import InvalidApplicationException
from datetime import datetime
class Applicant:
def __init__(self, name, address, nationality, passport_number, passport_expiry, phone, email):
self._name = name
self._address = address
self._nationality = nationality
self._passport_number = passport_number
self._passport_expiry = passport_expiry
self._phone = phone
self._email = email
today = datetime.today()
six_months_ahead = today.replace(month=today.month + 6) if today.month <= 6 else today.replace(year=today.year + 1, month=(today.month + 6) % 12)
#if datetime.strptime(self._passport_expiry, "%d/%m/%Y") < six_months_ahead:
# raise InvalidApplicationException("Passport expiry must be at least 6 months from today.")
def get_name(self):
return self._name
def set_name(self, name):
self._name = name
def get_address(self):
return self._address
def set_address(self, address):
self._address = address
def get_nationality(self):
return self._nationality
def set_nationality(self, nationality):
self._nationality = nationality
def get_passport_number(self):
return self._passport_number
def set_passport_number(self, passport_number):
self._passport_number = passport_number
def get_passport_expiry(self):
return self._passport_expiry.strftime("%d/%m/%Y")
def set_passport_expiry(self, passport_expiry):
self._passport_expiry = datetime.strptime(passport_expiry, "%d/%m/%Y")
def get_phone(self):
return self._phone
def set_phone(self, phone):
self._phone = phone
def get_email(self):
return self._email
def set_email(self, email):
self._email = email
def __str__(self):
return f"{self._name} ({self._nationality})"
what do I look at?
wow uh...
The only thing I can think of
is that I am running macos and you're on windows
um
idk will i try running through cmd?
Can you try adding this line in main.py and see if anything prints when you run the code?
okay
This is my output by the way
print(f"Adding applicant '{applicant}' to list")
Damn...
Any idea?
noproblem thanks anyways.
Sorry that I couldn't help much π
what is the content of applitcants.json?
[
{
"name": "Victoria Ratliffe",
"address": "25 Fortune Street, Durham, North Carolina, USA",
"nationality": "American",
"passport_number": "TEX890124",
"passport_expiry_date": "29/09/2030",
"phone_number": "+188851234",
"email_address": "[email protected]"
},
{
"name": "Tanya McQuoid",
"address": "18 Rodeo Drive, Beverly Hills, Los Angeles, California, USA",
"nationality": "American",
"passport_number": "CAL934521",
"passport_expiry_date": "30/04/2025",
"phone_number": "+192310062",
"email_address": "[email protected]"
},
{
"name": "Lucia Greco",
"address": "25 Via Del Alpi, Erice, Trapani, Sicilia, Italia",
"nationality": "Italian",
"passport_number": "PX79201H",
"passport_expiry_date": "20/06/2029",
"phone_number": "+3909034521",
"email_address": "[email protected]"
},
{
"name": "Quentin Hollander",
"address": "Apartemento 78, Via Etnea, Catania, Sicily, Italia",
"nationality": "British",
"passport_number": "UK9000125",
"passport_expiry_date": "22/01/2026",
"phone_number": "+4456123401",
"email_address": "[email protected]"
},
{
"name": "Armond Bartlett",
"address": "23 Ocean View, Sydney, Australia",
"nationality": "Australian",
"passport_number": "RTI909123",
"passport_expiry_date": "19/03/2035",
"phone_number": "+6145310960",
"email_address": "[email protected]"
}
]
please remove try-except in ReadJSONFile
it is likely hiding the issue
or at least log it
if the file doesn't exist
you're running code from a different directory
in your VSCode, go to File, then Open Folder
you're right
yeah
File "c:\Users\PC\Desktop\assignment\New folder\tourismvisa.py", line 34, in init
raise InvalidApplicationException("Intended date of entry must be at least 10 days from today.")
invalidapplicationexception.InvalidApplicationException: Intended date of entry must be at least 10 days from today.
PS C:\Users\PC\Desktop\assignment\New folder>
Any Idea about this?
Thats line 17 and 18 of applicants.py
I didnβt know if you did that on purpose or not so I just commented it out when looking at your code
i was trying to make the expiry of 6 months
maybe i did it incorrectly but im only getting error now so i believe its incorrect now
Oh wait nvm thats not it
Um well I donβt have my computer in front of me anymore
see if someone else can help
no problem
Hi are you able for help.
Did you enter a date that wasn't 10 days from today?
I tried 1 year , 1 day 20days
All no differenece
All no differenece
Can you send me everything that you put in as inputs
Here is what I put in btw
==== Muchkinland Visa Application System ====
1. Process Visa Application
2. Exit
Enter your choice (1-2): 1
Select Visa Type:
1. Tourism Visa
2. Student Visa
3. Employer Sponsored Visa
Enter visa choice (1-3): 1
List of Applicants:
1. Victoria Ratliffe (American)
2. Tanya McQuoid (American)
3. Lucia Greco (Italian)
4. Quentin Hollander (British)
5. Armond Bartlett (Australian)
Enter applicant number or type 'search' to search by name: 1
Enter intended date of entry (dd/mm/yyyy): 15/5/2025
Enter intended date of departure (dd/mm/yyyy): 15/6/2025
Enter Hotel/Tour company name: Big Hotel
Enter Hotel/Tour company address: 123 Big Hotel Street
Tourism Visa Details:
Applicant: Victoria Ratliffe (American)
Entry Date: 15/05/2025
Departure Date: 15/06/2025
Hotel/Tour Name: Big Hotel
Hotel/Tour Address: 123 Big Hotel Street
Visa Category: NONIMMIGRANT
==== Muchkinland Visa Application System ====
1. Process Visa Application
2. Exit
Enter your choice (1-2):
dude you booked a date for 1999
you're getting an error because you can't do that
Use these
Entry Date: 15/05/2025
Departure Date: 15/06/2025
@quartz hare
all good π
This help channel has been closed. 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.