题解 | 牛客网的IP地址

牛客网的IP地址

https://www.nowcoder.com/practice/b4159a20aefa406aaa1bfd7d9739c70c

a=input().split('.')
if len(a) != 4:
    print('illegal')
else:
    for i in a:
        if not i.isdigit():
            print("illegal")
            break
        elif int(i)>255 or int(i)<0:
            print('illegal')
            break           
    else:
            print('legal')
        
    

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务