Computer NetworksNETWORKS

Validate IP Address | Python Interview Question | Leetcode

In this video we need to write a function to validate if a string is a valid ip address or not. A valid ip address should be in form of x1.x2.x3.x4 where x1,x2,x3,x4 should be numbers between 0 and 255

Most Asked Join Based Interview Question:

Data Analyst Spotify Case Study:

Top 10 SQL interview Questions:

Interview Question based on FULL OUTER JOIN:

Playlist to master SQL :

Rank, Dense_Rank and Row_Number:

Spyder IDE link : https://www.spyder-ide.org/

#dataengineer #python

source

ipv4

Alice AUSTIN

Alice AUSTIN is studying Cisco Systems Engineering. He has passion with both hardware and software and writes articles and reviews for many IT websites.

20 thoughts on “Validate IP Address | Python Interview Question | Leetcode

  • you haven't consider the case of (0.0000,0.0000,0.0000,0.0000) this ip address is invalid while using the approach you told it is not handling the case well

  • very good explanation bro, please make more videos on python using same IDE

  • My implementation:-
    def isvalid(ip):

    x=ip.split('.')

    c=0

    for i in x:

    if int(i) in range(0,255):

    c+=1

    else:

    c+=0

    if c==4:

    print('It is an ip')

    else:

    print('It is not an ip')

    Please post more interview questions on python😊.

  • wow man, I am actually studying in Canada and even my professors can't explain this well, amazing job sir.

  • Completed your both playlist basics one 4 times and complex one 2 times. Now playing randomly and solving by myself to gain confidence.

    Thanks Big Brother !!

  • Awesome ! Thanks for the video. @Ankit, Now time to create more playlist for python.

  • Thanks Ankit. Hope the python playlist will also have interview q/realtime scenarios like your sql playlist

  • Thank you Ankit

    Looking forward for more tutorial..

  • Thanks Ankit for your python video ..your explanation is good like SQL . Expecting more python videos from you ..

  • My Implementation

    def isvalid_ip(ip):
    values=ip.split('.')
    if len(values)==4:
    for i in values:
    if not i.isdigit() or int(i)>255 or int(i)<0:
    return False
    return True

Comments are closed.