Back

Mathematics Q#16 in Codekata

Created 3 years ago
206 Views
2 Comments
Aishwarya9b4Hpr
@Aishwarya9b4Hpr
Aishwarya9b4Hpr
@Aishwarya9b4HprProfile is locked. Login

Q: In XYZ country there is rule that car’s engine no. depends upon car’ number plate. Engine no is sum of all the integers present on car’s Number plate.The issuing authority has hired you in order to provide engine no. to the cars.Your task is to develop an algorithm which takes input as in form of string(Number plate) and gives back

Engine number.

My code: Number_plate = str(input())

a = int(Number_plate[2:3])

b = int(Number_plate[3:4])

c = int(Number_plate[8:9])

d = int(Number_plate[9:10])

e = int(Number_plate[10:11])

f = int(Number_plate[11:12])

Engine_number = a + b + c + d + e + f

print(Engine_number)

Issue: Failure in test case 2


Private Testcase #2
Testcase Status:
>>> error
Input:
HR06-J-7801
Expected Output:
22
Actual Output:
Traceback (most recent call last):
  File "main.py", line 8, in 
    f = int(Number_plate[11:12])
ValueError: invalid literal for int() with base 10: ''
Comments (2)
Please login to comment.