-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
I have been working on this addition to the RPS game. I have installed prompt-toolkit 3.0.5. As I have been coding along with you, I have received the following error:
File "/PycharmProjects/RPS/RPS-v8.py", line 157
word_comp: object = word_completer(roll_names)
^
SyntaxError: invalid syntax
I can't figure out what is causing the error as I have attempted to follow your code...there were some differences that came up when I entered the WordCompleter...the autofill had me use word_completer for example. Below is the section of code that relates:
def get_roll(player_name, roll_names):
print(f"Available rolls: {', '.join(roll_names)}"
# for index, r in enumerate(roll_names, start=1):
# print(f"{index}. {r}")
word_comp = word_completer(roll_names)
roll = prompt(f"{player_name}, what is your roll: ", completer=word_comp)
text = input(f"{player_name}, what is your roll?")
selected_index = int(text) - 1
if not roll or roll not in roll_names:
print(f"Sorry {player_name}, {roll} is not valid!")
return None
return roll
Metadata
Metadata
Assignees
Labels
No labels