Apr-17-2020, 12:24 PM
With this in
the error was highlighting the apostrophe
if I remove the apostrophes I get an invalid syntax highlighting the letter G on Card Game Scores.
print ("Time for the results!!!") #prints time for results time.sleep(1) #adds a one second break if amount_of_player_1_cards > amount_of_player_2_cards: #if the amount of cards player one has is bigger than the amount player two has print ("The winner, with " + amount_of_player_1_cards + " is....... " + username_1) #tells you the winner time.sleep(1) #adds a one seocnd break print (username_1 + " got the cards: ") #tells you what cards they got print (player_1_cards) #shows the cards time.sleep(1) #adds a one second break print ("That makes " + username_2 + " second place with " + amount_of_player_2_cards + " cards") #tells you who came 2nd with open("Card Game Scores.csv", "a+", newline = "") as save_score: #looking at what is in the file save_score.write(player_1_results) #writes in the file what the users results were save_score.write("\n") #adds a space to make it clearer save_score.close() #saves and closes the file else: print ("The winner, with " + amount_of_player_2_cards + " is....... " + username_2) #tells you the winner time.sleep(1) #adds a one second break print (username_2 + " got the cards: ") #tells you what cards they got print (player_2_cards) #shows the cards time.sleep(2) #adds a one second break print ("That makes " + username_1 + " second place with " + amount_of_player_1_cards + " cards") #tells you who came 2nd with open("Card Game Scores.csv", "a+", newline = "") as save_score: #looking at what is in the file save_score.write(player_2_results) #writes in the file what the users results were save_score.write("\n") #adds a space to make it clearer save_score.close() #saves and closes the file #################################################################################################### time.sleep(2) #adds a 2 second break print ("This is how your scores compare to other winners of this game: ") #tells you this is how your socres compare to others time.sleep(1) #adds a 2 second break print ("This is these players most recent scores: ") #tells you these are there most recent scores time.sleep(1) #adds a 1 second break def first_seven_rows("Card Game Scores.csv"): with open(Card Game Scores.csv) as csvfile: reader = csv.reader(csvfile) for n, row in enumerate(reader): if n > 6: break print(f"{n}: {row}")I get the error
Error:invalid syntax
the error is where I entered my filename I enter ("Card Game Scores.csv")the error was highlighting the apostrophe
if I remove the apostrophes I get an invalid syntax highlighting the letter G on Card Game Scores.