Ask your own question, for FREE!
Computer Science 14 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
Gucchi: English help
8 hours ago 4 Replies 1 Medal
XxXGhostXxX: Help me wit math
5 hours ago 6 Replies 2 Medals
danielfootball123: Many of you have gum dieses and don't know it .. Here is how to cure it.
14 hours ago 23 Replies 1 Medal
uknownprttyfacekayla: Happy birthday to my irl sister @skyanne
6 hours ago 11 Replies 0 Medals
Spectrum: HAPPY BIRTHDAY @ultrilliam!
9 hours ago 22 Replies 5 Medals
gelphielvr: (Algebra1) need help asap Question in the replies
22 hours ago 5 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!