+ 2

How to request multiple inputs for Code Coach challenges? (Python 3)

Hello! I have been having some issues with some of the Code Coach challenges. Whenever multiple inputs are required, it seems that they are not being filled out at all when the code is run. I've tried list comprehension, .split(), and having separate input() functions for my variables, but it always seems like they are not filled it. Is there a way to format it correctly?

4th Jun 2020, 12:32 AM
Will L
Will L - avatar
9 Réponses
+ 1
Hi everyone, Your answers are very appreciated. It turns out that I misspelled a variable in the code ("driver" instead of "drivers") and that was the source of the error, not the input. Nevertheless, thank you all!
5th Jun 2020, 12:35 AM
Will L
Will L - avatar
+ 2
You can test your code here on the Playground, step by step, and see with a few different inputs if the results are as expected.
4th Jun 2020, 1:24 AM
JaScript
JaScript - avatar
+ 1
You can try a loop There was a challenge where multiple inputs were required, the first one declares the number of the following inputs, asking for one input and using it to make a loop that asks for the specific number of inputs might help.
4th Jun 2020, 1:53 AM
Ali Abdelhady
Ali Abdelhady - avatar
+ 1
Will L just add three inputs, it should work
4th Jun 2020, 2:19 AM
Ali Abdelhady
Ali Abdelhady - avatar
+ 1
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 Yes I tried it using the Python IDLE shell on my PC and it worked for the first test case. Here is the code: test1 = input() test2 = input() test3 = input() def waiting_time(name, agents, drivers): if isinstance(drivers,str) == True: drivers = drivers.sort() drivers.append(name) drivers.sort() active = drivers[:agents] passive = driver[agents:] if name in active: return 20 else: passive.remove(name) return 20 + waiting_time(name, agents, passive) print(waiting_time(test1, test2, test3))
4th Jun 2020, 2:25 AM
Will L
Will L - avatar
+ 1
Hi Will L, if you follow following steps you will pass all the test cases: a=input () b=int (input ()) c=input () For this problem it works Then perform operations on inputs a,b,c And solve your problem Enjoy coding
4th Jun 2020, 6:53 PM
Akash Babasaheb Chavan
Akash Babasaheb Chavan - avatar