TOPIC

Wrong answer (10%)

gentildpinto asked 4 years ago

# -*- coding: utf-8 -*-
while True:
  try:
    n = list(input())
    f = "".join(n)
    if not n or f.isspace():
      print("error")
    else:
      for i in range(len(n)):
        if n[i] == "O" or n[i] == "o":
          n[i] = "0"
        elif n[i] == "l":
          n[i] = "1"
        elif n[i] == "," or n[i] == " ":
          n[i] = ""
      n = "".join(n)
      if n.isdigit():
        if int(n) < 2147483647 and int(n) >= 0:
          if n == 00:
            print(0)
          print(n)
        else:
          print("error")
      else:
        print("error")
  except EOFError:
    break;

Remember not post solutions. Your post may be reviewed by our moderators.

  • jdmrosello replied 4 years ago

    Check this: " if int(n) < 2147483647 and int(n) >= 0:",using integer is the error here, unsigned long value is used instead, import ctypes