Help me in solving CCHOCOLATES problem

My issue

x=int(input())

ValueError: invalid literal for int() with base 10: ‘10 10 10’

My code

t=int(input())
for i in range(t):
    x=int(input())
    y=int(input())
    z=int(input())
    amt=x*5+y*10
    n=amt/z
    print(n)

Learning course: Basic Math using Python
Problem Link: CodeChef: Practical coding for everyone

Use map() function and split() function for taking multiple inputs from the user.
Correct code would be:
t=int(input())
for i in range(t):
x,y,z = map(int,input().split())
amt=x5+y10
n=amt//z
print(n)

Hope you find this helpful.

1 Like