Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('input.txt', encoding='utf-8')
- line = file.readline()+'.'
- file.close()
- point = 0
- num = ''
- res = 'NO'
- for s in line:
- if point <= 3:
- if s in '0123456789':
- num += s
- else:
- if num and s == '.' and 0 <= int(num) <= 255:
- point += 1
- num = ''
- else:
- break
- if point == 3 and num and 0 <= int(num) <= 255:
- res = 'YES'
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment