How to write python codes in codechef

I tried the ATM problem of the tutorial section.
I wrote the following code.

if(a%5==0 and a<=b):
else: print(b)

But an error occurred at line 1. Please guide me, how to write the input line!

What error?

Are you trying to “Run” without Providing “Custom Input”?

1 Like

It’s working with custom input. But when I am submitting the code. Machine is providing the inputs in list format. That’s causing the error.

I even tried
# cook your dish here
a, b = list(map(int, input().strip().split(’ ')))
if(a%5==0 and a<=b):
else: print(b)
yet the NZEC error persists

Trying this solution with the sample test input:

30 120.00

gives the following error:

Traceback (most recent call last):
  File "./", line 2, in <module>
ValueError: invalid literal for int() with base 10: '120.00'

which is hopefully enough of a clue :slight_smile:


b==>int? are you sure

Do I need to change a, b = list(map(int, input().strip().split(’ '))) this line?

chef is asking you to input 2 values

a and b are integer example(30,120)

but you have to input it as(30,120.00)

1 Like

problem was solved with a, b = list(map(float, input().strip().split(’ '))).

1 Like

To input two variables you don’t need to use list
you can use
here, the split function will directly split it using spaces

I think it would not, In the question input is space separated.

yes my bad .