You're using f-string, which is added in 3.6. The version of python3 used
in codejam is 3.5. Check
https://codingcompetitions.withgoogle.com/codejam/faq#platform for more
details. I would recommend
print("Case #{}: ".format(case), *result[case])
On Monday, April 6, 2020 at 5:54:19 PM UTC-7, Nirmal Purohit wrote:
>
> I have following Python3 code which works perfectly with my windows
> machine but give run time error on the code Jam:
> import numpy as np
> from collections import OrderedDict
>
> result = OrderedDict()
>
> for case in range(int(input())):
> numRows = numCols = 0
> mat = np.array([input().split() for _ in range(int(input()))],
> dtype=int)
> matTrace = np.trace(mat)
> for row in range(mat.shape[0]):
> if len(set(mat[row][:])) != mat.shape[0]:
> numRows += 1
> if len(set(mat[:,row])) != mat.shape[0]:
> numCols += 1
> result[case + 1] = [matTrace, numRows, numCols]
>
> for case in result:
> print(f"Case #{case}: ", *result[case])
>
>
> Please can anyone provide the reason?
>
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/bb152c79-208e-4fbe-9f77-c0289c534c6c%40googlegroups.com.