Why does this code throw an error?

Why does this code throw an error:

letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] points = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10] letter_to_points = {letter: point for letter, point in zip(letters, points)} lowercase_letter_to_points = {letter.lower(): point for letter, point in zip(letters, points)} letter_to_points.update(lowercase_letter_to_points) letter_to_points[""] = 0 def score_word(word): point_total = 0 for letter in word: point_total += letter_to_points.get(letter, 0) return point_total #brownie_points = score_word("BROWNIE") #print(brownie_points) player_to_words = {"player1": ["BLUE", "TENNIS", "EXIT"], "wordNerd": ["EARTH", "EYES", "MACHINE"], "Lexi Con": ["ERASER", "BELLY", "HUSKY"], "Prof Reader": ["ZAP", "COMA", "PERIOD"]} player_to_points = {} def update_point_totals(): for player, words in player_to_words.items(): player_points = 0 for word in words: player_points += score_word(word) player_to_points[player] = player_points def play_word(player, word): player_to_words[player].append(word) def show_player_to_points(): for player, points in player_to_points.items(): print("{player} has scored {points} points.".format(player = player, points = points)) while True: for player in player_to_words.keys(): word = input("{player} can you please enter a word.".format(player = player)) play_word(player, word) update_point_totals() show_player_to_points()

Run it and then if you know the answer please post it(if you know the programming language Python).Please give me a detailed answer.

You mean this error:

Traceback (most recent call last):
  File "main.py", line 29, in <module>
    word = input("{player} can you please enter a word.".format(player = player))
EOFError: EOF when reading a line

Codecademy has problems with the input() method sometimes.

what if you run your code here:


1 Like

Isn’t the input() method(you said it was an method) a function?

Why does Codecademy have problems? Explain for me.

Why can’t we fix the problems?

yes, input() is a function. The longer you program, the lousier you on occasion you get with perfect naming

I am only helping on the forum, this is a question for one of the engineers/developers at codecademy. Or maybe the CM can answer this. I can’t help you with this

1 Like

How can I ask the engineers/developers? What is the CM?

How can I ask the engineers/developers? What is the CM?

A CM is a Community Manager; they work for CC. But they are already aware of this issue.
(Note, CM can also mean Candidate Master, amongst other things…)

1 Like

What is the CC? How do I ask the CM, one of the engineers and one of the developers at Codecademy?

codeneutrino says they are aware.

CC = codecademy

How can I improve the code(the code at the top of the page)?

What about that? I’ve waited for months.

As you well know by now, the super users (SU) en moderators are only volunteers on the forum. I can’t and actually go solve this problem myself in the codecademy code-base.

1 Like

Do you have an account for the main CC page?

Of course I do, please just get to the point straight away. I will manage :wink:

1 Like

This point:
The 1st post and the 13th post.
Also, do you do any more courses on CC(not CC Forums).

Since the input() method is creating an error, what could you do to avoid that error?

That time I used .format() over f strings but now I use the reverse. Is there anything that .format() provides that is not ìn f strings. When would you use .format() over f strings.

Mainly, you’d use .format() if you were using Python 2.6+. f-strings only came in in Python 3, so if you’re using an earlier version of Python, f-strings won’t be accessible. You can read more about it here.

1 Like