programming help
so this is my assignment
#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): ")
this is my code here
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
my output should look like this
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
@ultrilliam can you please help with this? dont want to bother
or @timmyspu
@extrinix
wait
nvm i thought i knew for a second
@vocaloid
can you please take a look
Bruh what.... My noggin. Ow. Hurts.
okay disregard what i was saying before i think the file is working now but there is another issue
whenever i write a time its all unavailable
how do i make times available
this is my full code
#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): ")
this is what it has to show
Where is aratox when we need him? :sob:
Python?
do you understand what the problem is
Give me a minute
okay
I assume the CSV file looks something like this? ```csv 600,500,1000,1200 ```
i think so i mean how would i check
==== Moved to DMs ==== (He ran out of replies allowed lol)
Join our real-time social learning platform and learn together with your friends!