#πŸ”’ Help with college assignment

127 messages Β· Page 1 of 1 (latest)

craggy starBOT
#

@quartz hare

Python help channel opened

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.

slender badger
#

!rule 9

craggy starBOT
#

9. Do not offer or ask for paid work of any kind.

slender badger
#

also post your code

#

getting help is free on this server

quartz hare
#

@slender badger you can help?

shy goblet
quartz hare
#

Its not just 1 file

#

And im not getting an error

stark plover
#

@quartz hare We can't help for assignments that are related to your studies

unborn orchid
#

we can just not ongoing exams

#

and we cant just give them the answer to hw

#

!rule exam

craggy starBOT
#

8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.

quartz hare
craggy starBOT
quartz hare
#

and i cant proceed further

slender badger
#

This is the function that isn't behaving as expected right?

quartz hare
slender badger
#

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

quartz hare
#

i can send the rest

slender badger
craggy starBOT
# quartz hare

Please react with βœ… to upload your file(s) to our paste bin, which is more accessible for some users.

craggy starBOT
# quartz hare

Please react with βœ… to upload your file(s) to our paste bin, which is more accessible for some users.

slender badger
#

give me a moment to set up the files

wheat wharf
#

!rule 9

craggy starBOT
#

9. Do not offer or ask for paid work of any kind.

slender badger
#

It seems the code you posted has errors

#

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

quartz hare
#

no problem, but is it printing applicants

#

or is it giving error and not printing applicants

slender badger
quartz hare
#

hmm

slender badger
#

Can you tell me which lines are okay to comment out

quartz hare
#

Any, you can try as I've backups to my original work. If you're willing to experiment

slender badger
#

ok sounds good

#

I got it to work

#

Not sure if this will work for you but this is what I changed

quartz hare
slender badger
#

Yes

quartz hare
#

hmm im still getting the same.

slender badger
#

Are we running the same code??

quartz hare
slender badger
#

no, sorry

quartz hare
#

can you maybe send the main.py and applicants here

#

maybe i wrote it in wrong

#

but i'd get an error

#

hmm

slender badger
#

alright i can try

craggy starBOT
slender badger
#

applicant.py

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})"
quartz hare
#

idk if its not updating or what but its not displaying

#

Look

slender badger
#

what do I look at?

quartz hare
slender badger
#

wow uh...

quartz hare
#

is it my vsc issue or something

#

i've no idea

slender badger
#

The only thing I can think of

#

is that I am running macos and you're on windows

#

um

quartz hare
slender badger
#

Can you try adding this line in main.py and see if anything prints when you run the code?

quartz hare
#

okay

slender badger
#

This is my output by the way

quartz hare
#

print(f"Adding applicant '{applicant}' to list")

slender badger
#

Damn...

quartz hare
slender badger
#

Well I can't replicate the issue so uh

#

idk

#

maybe someone else can help?

quartz hare
#

noproblem thanks anyways.

slender badger
#

Sorry that I couldn't help much 😐

undone otter
quartz hare
#

[
{
"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]"
}
]

undone otter
#

ah, nvm, found it

#

yeah

undone otter
#

it is likely hiding the issue

#

or at least log it

#

if the file doesn't exist

quartz hare
undone otter
#

in your VSCode, go to File, then Open Folder

quartz hare
#

you're right

undone otter
#

then open the folder of your project

#

instead of opening files in VSC one by one

quartz hare
#

thank you

#

@slender badger You still there

slender badger
quartz hare
#

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?

slender badger
#

I didn’t know if you did that on purpose or not so I just commented it out when looking at your code

quartz hare
#

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

slender badger
#

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

quartz hare
#

no problem

quartz hare
slender badger
quartz hare
#

All no differenece

#

All no differenece

slender badger
#

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): 
quartz hare
slender badger
#

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

quartz hare
#

sec

#

Okay it works

#

perfect thank you sorry

slender badger
craggy starBOT
#
Python help channel closed using Discord native close action

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.