1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vlabodo [156]
3 years ago
15

Write a python program to read four numbers (representing the four octets of an IP) and print the next five IP addresses. Be sur

e to verify that the second, third and fourth numbers are between 0 and 255. The first one should be between 1 and 255.
Computers and Technology
1 answer:
sdas [7]3 years ago
8 0

Answer:

first_octet = int(input("Enter the first octet: "))

second_octet = int(input("Enter the second octet: "))

third_octet = int(input("Enter the third octet: "))

forth_octet = int(input("Enter the forth octet: "))

octet_start = forth_octet + 1

octet_end = forth_octet + 6

if (1 <= first_octet <= 255) and (0 <= second_octet <= 255) and (0 <= third_octet <= 255) and (0 <= forth_octet <= 255):

   for ip in range(octet_start, octet_end):

       forth_octet = forth_octet + 1

       if forth_octet > 255:

           forth_octet = (forth_octet % 255) - 1

           third_octet = third_octet + 1

           if third_octet > 255:

               third_octet = (third_octet % 255) - 1

               second_octet = second_octet + 1

               if second_octet > 255:

                   second_octet = (second_octet % 255) - 1

                   first_octet = first_octet + 1

                   if first_octet > 255:

                       print("No more available IP!")

                       break

       print(str(first_octet) + "." + str(second_octet) + "." + str(third_octet) + "." + str(forth_octet))

else:

   print("Invalid input!")

Explanation:

- Ask the user for the octets

- Initialize the start and end points of the loop, since we will be printing next 5 IP range is set accordingly

- Check if the octets meet the restrictions

- Inside the loop, increase the forth octet by 1 on each iteration

- Check if octets reach the limit - 255, if they are greater than 255, calculate the mod and subtract 1. Then increase the previous octet by 1.

For example, if the input is: 1. 1. 20. 255, next ones will be:

1. 1. 21. 0

1. 1. 21. 1

1. 1. 21. 2

1. 1. 21. 3

1. 1. 21. 4

There is an exception for the first octet, if it reaches 255 and others also reach 255, this means there are no IP available.

- Print the result

You might be interested in
Amye is in high school. As part of one of her classes, she had to identify the legality of different situations that involved
adell [148]
I say you should pick answer 1. an HR makes more sense since she is interested in a topic about the legality of different situations that are related to workers and their employers.
8 0
3 years ago
Read 2 more answers
Before using your Twitter account to market your personal brand, you should evaluate Your profile picture Your bio Your tweets A
AnnZ [28]
D. All of the Above.

If you are using a Twitter account for marketing your personal brand, you certainly should evaluate your entire profile, which includes your pictures, bio and tweets.  
5 0
3 years ago
You're installing two new hard drives into your network attached storage device. Your director asks that they be put into a RAID
bekas [8.4K]

Answer:

d. RAID 6

Explanation:

RAID is a data storage technology that combines multiple physical disk drive components into a single logical unit. The functions of RAID is to provide performance and redundancy.

RAID 0 provides data stripping but it does not offer data stripping.

RAID 1 increases performance to about 2x but it limits the disk capacity to about 50%

RAID 5 provides redundancy and increased perfomance but it is limited to small disk drive.

RAID 6 also provides redundancy but it slows performance

RAID 10 increases performance and data protection.

RAID 6 is the best drive that offers redundancy over performance.

8 0
3 years ago
bilmain manufactures has recruited you as a network administrator to handle the organization's network operations. you want to s
Art [367]

Since Bilmain manufactures has recruited you as a network administrator to handle the organization's network operations, the subnet mask for this class A address is 255.0.0.0.

<h3>Why is a subnet mask of 255 usually used?</h3>

The 255 address, or host address of all ones in binary notation, is used to send a message to every host on a network. It's important to keep in mind that no host can be given the first or final address in a network or subnet. You ought to be able to assign IP addresses to 254 hosts at this point.

A subnet mask is a 32-bit integer that is produced by setting all host bits to 0 and all network bits to 1. The subnet mask does this by dividing the IP address into network and host addresses. The "0" address is always a network address, but the "255" address is always allocated to a broadcast address.

Hence, The subnet mask for a class C network would be 255.255.255.0, which indicates that 24 bits are being used for the network. This is shown in CIDR notation by adding a /24 after the IP address.

Learn more about subnet mask from

brainly.com/question/28256854
#SPJ1

5 0
1 year ago
Explain what the color range ( green and red ) in this interactive map represents
katrin2010 [14]

Answer:

You should send a picture of the map so people can answer directly.

Explanation:

3 0
3 years ago
Other questions:
  • PLS HELP!!
    13·1 answer
  • In this website/app what are the points for?
    7·1 answer
  • What is it called when you make a reference in the text of a document alerting the reader that you are using information from an
    10·1 answer
  • Assume that the array arr has been defined and initialized with the values {4, 2, 5, 3, 1}. What are the values in the array arr
    15·1 answer
  • In preparing his persuasive presentation, Reza should most likely focus on clearly presenting his
    6·2 answers
  • Why would businesses apply cell protection to spreadsheet entries? Provide one specific example.
    10·1 answer
  • Please help!
    10·2 answers
  • Hi, I just have a few questions from my digital tech assignment.
    14·2 answers
  • What are some signs that could help you determine that a date and time was inserted as a special object instead of
    14·1 answer
  • Ok so I’m using a word document and towards the bottom of the page it stops me from moving my text box any further down even tho
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!