Python
Design a class named IP_address to represent IP address objects. The IP_addressclass contains the following
For example, consider the following code fragment:
ip_key = '192.168.0.24' data_list =[(0, 84), (1, 84), (2, 84), (3, 84), (4, 84), (5, 84), (6, 84), (7, 84), (8, 84), (9, 84), (10, 84), (11, 84), (12, 84), (13, 84), (14, 84), (15, 84), (16, 84), (17, 84), (18, 84), (19, 84), (20, 84)] size = 3 ip = IP_address(key, data_list, size)
The data_list contains a list of tuple objects. Each tuple consists of the time-period value and the packet-size. You should summarize this list and create a frequency list, a sum of the packet-size list and an average of the packet-size list. There are a lot of data for each time-period value. We calculate the total number of bytes that the source host sent for each 10-second interval. For example, the above data_list will be divided into 3 groups, such as (0-9 second), (10-19 second) and (20-29 second)
Therefore, the IP_address object should contain:
This will give
ip_key = '192.168.0.24' data_list =[(0, 84), (1, 84), (2, 84), (3, 84), (4, 84), (5, 84), (6, 84), (7, 84), (8, 84), (9, 84), (10, 84), (11, 84), (12, 84), (13, 84), (14, 84), (15, 84), (16, 84), (17, 84), (18, 84), (19, 84), (20, 84)] size = 3 ip = IP_address(ip_key, data_list, size) print(ip.get_ip_address()) |
192.168.0.24 |
And
For example, consider the following code fragment:
ip_key = '192.168.0.24' data_list =[(0, 84), (1, 84), (2, 84), (3, 84), (4, 84), (5, 84), (6, 84), (7, 84), (8, 84), (9, 84), (10, 84), (11, 84), (12, 84), (13, 84), (14, 84), (15, 84), (16, 84), (17, 84), (18, 84), (19, 84), (20, 84)] size = 3 ip = IP_address(key, data_list, size)
The data_list contains a list of tuple objects.
Therefore, the ip object should contain:
For example
Test result
ip_key = '192.168.0.24' data_list = [(0, 84), (1, 84), (2, 84), (3, 84), (4, 84)] size = 3 ip = IP_address(ip_key, data_list, size) print(ip.get_sum_list()) print(ip.get_avg_list()) |
get_sum_list: [[0, 840], [1, 840], [2, 84] get_avg_list: [[0, 84.0], [1, 0], [2, 0]] |
|||
ip_key = '192.168.0.2' data_list = [(33, 60), (34, 64), (34, 1500), (34, 712), (35, 52), (35, 60), (36, 52), (36, 287), (37, 52), (37, 52), (37, 52), (39, 60), (40, 643), (40, 52)] size = 5 ip = IP_address(ip_key, data_list, size) print(ip.get_sum_list()) print(ip.get_avg_list()) |
get_sum_list: [[0, 0], [1, 0], [2, 0], [3, 3003], [4, 695]] get_avg_list: [[0, 0], [1, 0], [2, 0], [3, 250.2], [4, 347.5]] |
|||
|
def stoogesort(arr, l, h):
if l >= h:
return
# If first element is smaller
# than last,swap them
if arr[l]>arr[h]:
t = arr[l]
arr[l] = arr[h]
arr[h] = t
# If there are more than 2 elements in
# the array
if h-l+1 > 2:
t = (int)((h-l+1)/3)
# Recursively sort first 2/3 elements
stoogesort(arr, l, (h-t))
# Recursively sort last 2/3 elements
stoogesort(arr, l+t, (h))
# Recursively sort first 2/3 elements
# again to confirm
stoogesort(arr, l, (h-t))
# deriver
arr = [2, 4, 5, 3, 1]
n = len(arr)
stoogesort(arr, 0, n-1)
for i in range(0, n):
print(arr[i], end = \' \')
# Code Contributed by Mohit Gupta_OMG <(0_o)>
sorry students the above answer was not given by me someone used my account and posted answer literally i have no knowledge about that question sorry
The one who answerd this mentioned his name too :(
Python Design a class named IP_address to represent IP address objects. The IP_addressclass contains the following...
Continue from the previous question, modify the following in the IP_address class. : add a method named get_statistics(). The get_statistics() method return a list of all statistics data (i.e. the ip address, total sum of all packet-size, total frequency, average of all packet-size) For example, consider the following code fragment ip_key = '192.168.0.24' data_list =[(0, 84), (1, 84), (2, 84), (3, 84), (4, 84), (5, 84), (6, 84), (7, 84), (8, 84), (9, 84), (10, 84), (11, 84), (12, 84),...
python 3.7 write a function called read_file() which accepts a filename and returns a list of tuple objects. For example, if we have the following data: 0.000000000 192.168.0.24 10.0.0.5 H-NM 1.001451000 192.168.0.24 10.0.0.5 2.002970000 192.168.0.24 10.0.0.5 3.003552000 192.168.0.24 10.0.0.5 4.005007000 192.168.0.24 10.0.0.5 then the list should contain the following: [('192.168.0.24', 0, 84), ('192.168.0.24', 1, 84), ('192.168.0.24', 2, 84), ('192.168.0.24', 3, 84), ('192.168.0.24', 4, 84)] Note: • Each line consists of a number of fields separated by a single tab character....
10. In a network an IP address and prefix is given as 192.168.130.34/17. What is the subnet mask? (A) 0.0.127.255 (B) 255.255.0.0 (C) 255.255.128.0 (D) 0.0.2.34 11. In a network an IP address and prefix are given as 192.168.130.34/17. How many host addresses are there? (A) 34 (B) 32766 (C) 131072 (D) 2 12. One result of subnetting is that the size of the routing table in the routers is reduced (A) True (8) False 13. The port number is...
comm & networks fund 12. (8pts) Change the following IP addresses from dotted- decimal notation to binary notation. a. 197.163.222.19 b. Show in details how to convert 197 into binary 13. (&pts) Change the following IP addresses from binary notation to dotted-decimal notation. a. 11011111 10110000 00011111 01011101 b. Show in details how to convert 01011101 into decimal 14. (6pts) Find the class of the following IP addresses (i.e., classful addressing) a. 11110111 11110011 10000111 11011101 b. 10101111 11000000 11110000...
(9 marks) Complete the following methods in the class MyLinkedList based the description provided. b. on i. (3 marks) size() return the number of items in the list. i. (3 marks) count Positives (): return the number of positive values in the list ii. (3 marks) (Advanced) reverse the order of the items in reverse ( the list. If the list is 10 90, then after calling the - 70 - 20 -> method, it should become 90 - 70...
Python Ask a user for their address. Based on their address, tell them what days they should bring an umbrella (>=50% chance of rain they should bring an umbrella). Output example Enter address: 15 Lisa Ct. Sewell NJ 08080 04/13/18 - Friday - Sun 04/14/18 - Saturday - Sun 04/15/18 - Sunday - Umbrella 04/16/18 - Monday - Sun 04/17/18 - Tuesday - Umbrella 04/18/18 - Wednesday - Sun 04/19/18 - Thursday - Umbrella 04/20/18 - Friday - Sun Weather...
Assume there is a machine with the IP address 129.82.102.63 with netmask /23, and with a parent NW whose netmask is 255.255.224.0. For each answer, do not include any spaces, give full IP addresses/netmasks where these are requested, give the "/" as part of the answer for slash notation. 1. How many bits are there for NW# portion (within the parent address space) for the subnet? 2. How many subnets of this size (the size of the subnet this machine is...
What is the network ID in the destination address? What is the host ID in the destination address? Write the destination IP address in dotted-decimal notation. Find the source IP address. What class is the source IP address? What is the network ID in the source address? What is the host ID in the source address? Write the source IP address in dotted-decimal notation. Can this message be delivered directly by the source to the destination, or will it require...
1 question is this choose mcq quickly 10 p The following data represent the total number of years of formal education for 40 employees of a bank. 13 17 13 14 12 17 19 13 15 13 16 18 13 11 19 19 14 15 13 15 17 18 17 14 13 17 12 17 17 16 16 17 15 13 13 14 12 14 1313 Construct a frequency distribution for the number of years of education. Number of years...
Network IP Addressing Network Layout of 2 networks Given an IP address and mask of 172.23.29.0/24, design an IP addressing scheme that satisfies the following requirements. Subnet B Specification This network requires space for 62 machines plus the router Number of bits in the subnet Blank 1 IP mask (binary) Blank 2 New IP mask (decimal) Blank 3 Maximum number of usable subnets of this size when using this mask (including the 0th subnet) Blank 4 Number of usable hosts...