473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Core Python Programming . . .

I'm working my way thru the book "Core Python Programming" 2d Edition
- Wesley Chun. . .

Trying to figure out what he's looking for on Page 248, Exercise 6-11
(a).

Is it supposed to be:

1) convert a 4-digit Integer (WXYZ) to an IP address (WWW.XXX.YYY.ZZZ)

or

2) convert an 8-digit Integer (WWWXXXYYYZZZ) to (WWW.XXX.YYY.ZZZ)

Thanks for anyone with the clue!!!
Jan 18 '08 #1
3 1433
FireNWater <kh****@gmail.comwrites:
1) convert a 4-digit Integer (WXYZ) to an IP address (WWW.XXX.YYY.ZZZ)

or

2) convert an 8-digit Integer (WWWXXXYYYZZZ) to (WWW.XXX.YYY.ZZZ)

Thanks for anyone with the clue!!!
Without being able to see the exercise I suspect it's turn a 4-byte
string (i.e. 32 bits) into an IP address (int8.int8.int8.int8).
Or, it might be turn a 32-bit int into such an address.
Jan 18 '08 #2
On Jan 18, 1:55 pm, Paul Rubin <http://phr...@NOSPAM.invalidwrote:
FireNWater <kho...@gmail.comwrites:
1) convert a 4-digit Integer (WXYZ) to an IP address (WWW.XXX.YYY.ZZZ)
or
2) convert an 8-digit Integer (WWWXXXYYYZZZ) to (WWW.XXX.YYY.ZZZ)
Thanks for anyone with the clue!!!

Without being able to see the exercise I suspect it's turn a 4-byte
string (i.e. 32 bits) into an IP address (int8.int8.int8.int8).
Or, it might be turn a 32-bit int into such an address.
I've got the book and I think the OP may be referring to this:

6-11 Conversion.
(a) Create a program that will convert from an integer to an
Internet Protocol (IP) address in the four-octet format of WWW.XXX.YYY.ZZZ
(b) Update your program to be able to do the vice verse of the
above.
It could be a 12 digit int...or it could be what you (Paul) are
referring to.

Mike
Jan 18 '08 #3
Mike Driscoll wrote:
>
6-11 Conversion.
(a) Create a program that will convert from an integer to an
Internet Protocol (IP) address in the four-octet format of WWW.XXX.YYY.ZZZ
(b) Update your program to be able to do the vice verse of the
above.
I think it's is asking to convert a 32-bit int to the dotted form.

It's a little known fact, but IP addresses are valid in non-dotted
long-int form. Spammers commonly use this trick to disguise their IP
addresses in emails from scanners.
Jan 19 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Matt Feinstein | last post by:
Hi all-- I'm new to Python, and was somewhat taken aback to discover that the core language lacks some basic numerical types (e.g., single-precision float, short integers). I realize that there...
1
by: jelle | last post by:
#No rant intended I'm not at all confused wether I should learn an one of the advanced array modules, I'm slightly confused over which I should pick up. I'm impressed with the efforts of SciPy...
6
by: malv | last post by:
Multiprocessing has been pushed into the field as the chip manufacturers can no longer deliver as they were used to for many years. The general public has been conditioned to believe that 1 + 1 =...
7
by: holly.woodland | last post by:
Hi All Apologies in advance for the pretty basic question - but I can't seem to find an answer anywhere else. I am developing a fluid sim in C++ and have heard that many people use Python in...
11
by: John Coleman | last post by:
Greetings, My copy of the second edition of Chun's "Core Python Programming" just arrived from Amazon on Friday. What really jumped out at me is an interesting feature about how it sequences its...
62
by: robert | last post by:
I'd like to use multiple CPU cores for selected time consuming Python computations (incl. numpy/scipy) in a frictionless manner. Interprocess communication is tedious and out of question, so I...
14
by: Sheldon | last post by:
Hi, I have a python script that uses a C extention. I keep getting a recurring problem that causes a core dump a few lines after the C extention return data back tp python. I tried using pbd and...
15
by: John Nagle | last post by:
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility,...
6
by: nikhilketkar | last post by:
What are the implications of the Global Interpreter Lock in Python ? Does this mean that Python threads cannot exploit a dual core processor and the only advantage of using threads is in that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.