TOPIC

Wrong answer (10%)

Gentil Pinto asked 1 year 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.

  • Jesús Daniel Menéndez Roselló replied 1 year 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