0

Why the error occuring?

states_needed = set([“mt”, “wa”, “or”, “id”, “nv”, “ut”, "ca", "az"]) stations = set () stations[“kone”] = set([“id”, “nv”, “ut”]) stations[“ktwo”] = set([“wa”, “id”, “mt”]) stations[“kthree”] = set([“or”, “nv”, “ca”]) stations[“kfour”] = set([“nv”, “ut”]) stations[“kfive”] = set([“ca”, “az”]) finel_station = {} while states_needed: states_covered = {} best_station = None for states, station in stations.items(): covered = states_needed & states if len(covered)>len(states_needed): best_station = station states_covered = covered states_needed -= states_covered final_station.add(best_station) OUTPUT :- File "main.py", line 1 states_needed = set([“mt”, “wa”, “or”, “id”, “nv”, “ut”, "ca", "az"]) ^ SyntaxError: invalid character in identifier

15th Apr 2022, 7:47 AM
Anshul Khangar
Anshul Khangar - avatar
3 Answers
+ 3
You need to use single(' ') or double(" ") quotes to denote a string (not “ ”)
15th Apr 2022, 8:05 AM
Simba
Simba - avatar
+ 1
my interpreter says what Simba says, use "" or '' only !
15th Apr 2022, 3:13 PM
Ervis Meta
Ervis Meta - avatar
0
Okay I got it...
15th Apr 2022, 3:14 PM
Anshul Khangar
Anshul Khangar - avatar