Python Forum
Collection of programming ideas and challenges
Thread Rating:
  • 7 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collection of programming ideas and challenges
#5
challenge #0

your function is given a string with an IP address possibly in there somewhere.  if there is no IP address, then just return None or raise an exception.  if there is an IP address, return a tuple with:

#0: where the first IP address starts in the string
#1: where the first IP address ends in the string

these 2 numbers are suitable for slicing the string to split the parts.

bonus: support multiple IP addresses (what should be returned?)
bonus: support IPv6 (what should be returned?)

challenge #1

write a program/script to sort the lines of a file by IP address as found by the function in the above challenge. be sure that 10.9.9.9 comes before 172.16.8.8

bonus: accept an argument/option to specify the index of which IP address is to be the sort key
bonus: support IPv6 (how will you collate IPv4-in-IPv6 relative to IPv4?)
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.


Messages In This Thread
RE: Collection of programming ideas - by metulburr - Oct-04-2016, 03:21 AM
RE: Collection of programming ideas - by Skaperen - Oct-04-2016, 04:24 AM
RE: Collection of programming ideas - by ichabod801 - Oct-04-2016, 09:36 PM
advanced coding challenges: find/sort ip addresses - by Skaperen - Nov-12-2016, 06:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Minigame Collection with Menu textmonster404 1 3,423 Feb-20-2017, 02:11 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020