Python error - no keyword arguments

Snop -  
RichardJeanChristophe Posted messages 8 Status Member -
Hello,
I wanted to code a program that would allow me to review my English vocabulary, and I wrote this program:

def revision(): import random question=[] reponse=[] nbr_fait=[] mot = ' ' mot_test=0 mot_en_cours = '' print('If you no longer want to add, type enter') while mot != '': mot = str(input('What question do you want to add? ')) if mot != '': question.append(mot) compteur = 0 while compteur != len(question): print('If you no longer want to add, type enter') mot = str(input('Add the answer for :', question[compteur], end=' ')) print(':x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:') print(' Starting the questions ') print(':x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:x:') print() #Generating the number to find a question to ask while mot_test in nbr_fait == True: if mot_test in nbr_fait == False: nbr_fait.append(mot_test) else: mot_test = question[random.randint(0,len(quetion))] chance = 3 while mot_en_cours != question[mot_test]: mot_en_cours = str(input('If I say ', question[mot_test],' you say : ')) compteur = compteur - 1 if compteur == 0: break


It allows me to fill in questions and answers that go with them.
Except that when the program is executed, an error message appears:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
revision()
File "C:\Users\Alonzo\Desktop\revisions.py", line 19, in revision
mot = str(input('Add the answer for :', question[compteur], end=' '))
TypeError: input() takes no keyword arguments

Configuration: Windows / Chrome 79.0.3945.117

2 answers

Anonymous user
 
Hello

I don't code in Python, but the error message says
input() takes no keyword arguments
basically meaning that no keyword (understood as an instruction) should be in the arguments of the input function.

A quick search on several sites shows me that input takes a string as an input, and in your line of code, there are several arguments including the keyword end
input('Add the response from:', question[counter], end=' ')

In my opinion, as a coder of other languages, you should construct your string in a variable and pass that variable as a single parameter to the input function.

When I was a kid, the Dead Sea was just sick.
George Burns
1
RichardJeanChristophe Posted messages 8 Status Member 2
 
Hey Alonzo, it's Richard Jean-Christophe. I can help you with that on Monday.
0
Snop
 
I agree, I await your response.
0
RichardJeanChristophe Posted messages 8 Status Member 2 > Snop
 
Sorry, I've been a bit forgetful lately and I forgot to help you this Monday.
Shall we meet this Monday then?
0