pycharm is giving me an error : not enough values to unpack(expected 2 but got 1) while codechef is accepting it.
why is pycharm or any other ide giving an error?
pycharm is giving me an error : not enough values to unpack(expected 2 but got 1) while codechef is accepting it.
why is pycharm or any other ide giving an error?
a, b= input().split() only work if the text inserted is a string whith only one space,
your code does in the code chef editor?
For clarity:
Example 1 : input -> ‘1 2’
a, b = input().split()
will lead to a,b = [‘1’, ‘2’]
ending with a = ‘1’ and b = ‘2’
Example 2: input -> ‘12’
a, b = input().split()
will lead to a,b = [‘12’]
leading to unpack error as [‘12’] will only have 1 value to unpack
Solution to 2:
try removing the .split() part.