Ask your own question, for FREE!
Computer Science 37 Online
Gucchi:

programming help

Gucchi:

1 attachment
Gucchi:

so this is my assignment

Gucchi:

#Muhammad Hassan #02/04/2025 #The purpose of this program is to plan an epic sunrise on the beach for racers by determining different weekend dates and times, which line up correctly. import csv #Display a welcome message print("Welcome to the official Charity Races!") #Portray and demonstrate the organization's main goal print("We are a non-profit organization that centres on brightening people's day and providing relief in the best way possible.") #Ask the user to enter a time to search for #Turn the input to a string while True: time = input("Please enter a race time of your choice in 24-hour format (example: 715 for 7:15 AM): ") if time.isdigit(): break print("I'm afraid that is invalid. Please enter numbers only.") time = str(time) #Open the "sun_data.csv" file with open("sun_data.csv", "r") as file: reader = csv.reader(file) #Put the sunrise times in a list sunrise_data = list(reader) #Use a for loop to search for the given time in the list found = False for row in sunrise_data: if len(row) < 2: continue csv_date, csv_time = row[0].strip(), row[1].strip() if csv_time == time: found = True #If the time is available #Display that the time is in the database print(f"Fortunately, the time {time} is indeed in our database.") #Ask to confirm if they would like to race choice = input("Would you be willing to race at this time? answer (yes/no): ").strip().lower() #If they say "yes" if choice == "yes": #Display a message saying thank you print(f"Thank you so much, we have booked you to run at {time}.") else: #If they say "no" print("That is absolutely fine! Do not hesitate to select another time.") break #If the time is not available if not found: print("My apologies, that time is currently unavailable.") #Ask if they would like to search for a different time search_again = input("Would you be willing to search for a later time? answer (yes/no): ").strip().lower() #If they say "no" if search_again == "no": #Display goodbye message print("Thank you for using the official Charity Races scheduler! I hope you have a wonderful day.") else: time = input("Please enter a new race time of your choice in 24-hour format (example: 715 for 7:15 AM): ")

Gucchi:

this is my code here

Gucchi:

and im getting this error: Welcome to the official Charity Races! We are a non-profit organization that centres on brightening people's day and providing relief in the best way possible. Traceback (most recent call last): module __main__ line 3 exec(ev.detail) module line 23 with open("sun_data.csv", "r") as file: IOError: Could not open file sun_data.csv : status 403

Gucchi:

1 attachment
Gucchi:

my output should look like this

Gucchi:

and it says on my assignment that the file has already been saved on my course idle so i dont get why it isnt working

Gucchi:

@ultrilliam can you please help with this? dont want to bother

Gucchi:

or @timmyspu

Gucchi:

@extrinix

fwval:

wait

fwval:

nvm i thought i knew for a second

Gucchi:

@vocaloid

Gucchi:

can you please take a look

Gdub08:

Bruh what.... My noggin. Ow. Hurts.

Gucchi:

okay disregard what i was saying before i think the file is working now but there is another issue

Gucchi:

Gucchi:

whenever i write a time its all unavailable

Gucchi:

how do i make times available

Gucchi:

this is my full code

Gucchi:

#Muhammad Hassan #02/04/2025 #The purpose of this program is to plan an epic sunrise on the beach for racers by determining different weekend dates and times, which line up correctly. import csv #Display a welcome message print("Welcome to the official Charity Races!") #Portray and demonstrate the organization's main goal print("We are a non-profit organization that centres on brightening people's day and providing relief in the best way possible.") #Ask the user to enter a time to search for #Turn the input to a string while True: time = input("Please enter a race time of your choice in 24-hour format (example: 715 for 7:15 AM): ") if time.isdigit(): break print("I'm afraid that is invalid. Please enter numbers only.") time = str(time) #Open the "sun_data.csv" file with open("sun_data.csv", "r") as csvFile: dataFile = csv.reader(csvFile, delimiter=",") #Put the sunrise times in a list sunrise_data = list(dataFile) #Use a for loop to search for the given time in the list found = False for row in sunrise_data: if len(row) < 1: continue csv_time = row[0].strip() if csv_time == time: found = True #If the time is available #Display that the time is in the database print(f"Fortunately, the time {time} is indeed in our database.") #Ask to confirm if they would like to race choice = input("Would you be willing to race at this time? answer (yes/no): ").strip().lower() #If they say "yes" if choice == "yes": #Display a message saying thank you print(f"Thank you so much, we have booked you to run at {time}.") else: #If they say "no" print("That is absolutely fine! Do not hesitate to select another time.") break #If the time is not available if not found: print("My apologies, that time is currently unavailable.") #Ask if they would like to search for a different time search_again = input("Would you be willing to search for a later time? answer (yes/no): ").strip().lower() #If they say "no" if search_again == "no": #Display goodbye message print("Thank you for using the official Charity Races scheduler! I hope you have a wonderful day.") else: time = input("Please enter a new race time of your choice in 24-hour format (example: 715 for 7:15 AM): ")

Gucchi:

1 attachment
Gucchi:

this is what it has to show

Glorious:

Where is aratox when we need him? :sob:

Extrinix:

Python?

Gucchi:

@extrinix wrote:
Python?
yeah

Gucchi:

do you understand what the problem is

Extrinix:

Give me a minute

Gucchi:

okay

Extrinix:

I assume the CSV file looks something like this? ```csv 600,500,1000,1200 ```

Gucchi:

i think so i mean how would i check

Extrinix:

==== Moved to DMs ==== (He ran out of replies allowed lol)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
unknownnnnnn: Static at 2 A.M. My mind doesnu2019t knock. It rearranges the furniture at 2 a.m., asks me to notice every creak. I lie still like that might help, like silence is a language my thoughts forgot. They line up with receipts, proof of moments I replayed too many times to pretend they were accidents. Iu2019m fluent in overthinking itu2019s the only subject I never skipped. I can turn one sentence into a courtroom drama, cross-examine my tone, convict myself without witnesses. People call me u201cstrongu201d because I donu2019t spill. They donu2019t see the cup shaking in my hands, how much effort it takes to keep the surface calm. Confidence comes in phases. Some days it fits like skin. Some days itu2019s a costume I forget Iu2019m wearing until it starts to pinch. I laugh on cue. I answer u201cfineu201d with convincing timing. Iu2019ve learned where to pause, how long eye contact should last, how not to sound like a question when Iu2019m one. The past isnu2019t loud. It doesnu2019t need to be. It just clears its throat at the wrong moments, reminds me what I already survived and what might try again. But hereu2019s the part I donu2019t downplay I stay. Even when my thoughts argue in circles, even when doubt files appeals. I choose presence over perfection. Breath over escape. I donu2019t win every round, but I donu2019t forfeit myself either. I am not the static. I am the one listening, deciding what deserves a response and what can fade without taking my name with it.
12 hours ago 2 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!