Check If Elements' Index Are Equal for List Elements in Python

AmitDiwan
Updated on 13-Sep-2021 07:31:34

646 Views

When it is required to check if the index of the elements is equal to the elements in the list, a simple iteration and the enumerate attribute is used.ExampleBelow is a demonstration of the same −my_list_1 = [12, 62, 19, 79, 58, 0, 99] my_list_2 = [12, 74, 19, 54, 58, 0, 11] print("The first list is :") print(my_list_1) print("The second list is :") print(my_list_2) my_list_1.sort() my_list_2.sort() print("The first list after sorting is ") print(my_list_1) print("The second list after sorting is ") print(my_list_2) check_list = [9, 8, 2] print("The check_list is :") print(check_list) my_result ... Read More

Convert List to Index and Value Dictionary in Python

AmitDiwan
Updated on 13-Sep-2021 07:28:01

698 Views

When it is required to convert a list into an index value dictionary, the ‘enumerate' and a simple iteration are used.ExampleBelow is a demonstration of the same −my_list = [32, 0, 11, 99, 223, 51, 67, 28, 12, 94, 89] print("The list is :") print(my_list) my_list.sort(reverse=True) print("The sorted list is ") print(my_list) index, value = "index", "values" my_result = {index : [], value : []} for id, vl in enumerate(my_list): my_result[index].append(id) my_result[value].append(vl) print("The result is :") print(my_result)OutputThe list is : [32, 0, 11, 99, 223, 51, 67, 28, 12, 94, ... Read More

Extend Consecutive Tuples in Python

AmitDiwan
Updated on 13-Sep-2021 07:24:47

160 Views

When it is required to extend consecutive tuples, a simple iteration is used.ExampleBelow is a demonstration of the same −my_list = [(13, 526, 73), (23, 67, 0, 72, 24, 13), (94, 42), (11, 62, 23, 12), (93, ), (83, 61)] print("The list is :") print(my_list) my_list.sort(reverse=True) print("The list after sorting in reverse is :") print(my_list) my_result = [] for index in range(len(my_list) - 1): my_result.append(my_list[index] + my_list[index + 1]) print("The result is :") print(my_result)OutputThe list is : [(13, 526, 73), (23, 67, 0, 72, 24, 13), (94, 42), (11, 62, 23, 12), (93, ... Read More

Filter Unique Valued Tuples in Python

AmitDiwan
Updated on 13-Sep-2021 07:23:26

256 Views

When it is required to filter unique valued tuples from a list of tuples, the ‘list’ and ‘set’ methods are used.ExampleBelow is a demonstration of the same −my_list = [(42, 51), (46, 71), (14, 25), (26, 91), (56, 0), (11, 1), (99, 102)] print("The list of tuple is :") print(my_list) my_list.sort() print("The list after sorting is :") print(my_list) my_result = list(set(my_list)) print("The result is :") print(my_result)OutputThe list of tuple is : [(42, 51), (46, 71), (14, 25), (26, 91), (56, 0), (11, 1), (99, 102)] The list after sorting is : [(11, 1), (14, 25), (26, 91), (42, 51), (46, ... Read More

Convert 3D Matrix to Coordinate List in Python

AmitDiwan
Updated on 13-Sep-2021 07:22:19

433 Views

When it is required to convert a three dimensional matrix into a co-ordinate list, the ‘zip’ method, and a list comprehension are used.ExampleBelow is a demonstration of the same −my_list_1 = [[['He', 'Wi'], ['llo', 'll']], [['Pyt', 'i'], ['hon', 'sFun']], [['Ho', 'g'], ['pe', 'ood']]] print("The list is : ") print(my_list_1) my_list_1.sort() print("The list after sorting is ") print(my_list_1) my_result = [ele for sub_elem_1, sub_elem_2 in my_list_1 for ele in zip(sub_elem_1, sub_elem_2)] print("The resultant list is : ") print(my_result)OutputThe list is : [[['He', 'Wi'], ['llo', 'll']], [['Pyt', 'i'], ['hon', 'sFun']], [['Ho', 'g'], ['pe', 'ood']]] The list after sorting is [[['He', ... Read More

Cross Pairing in Tuple List in Python

AmitDiwan
Updated on 13-Sep-2021 07:19:29

307 Views

When it is required to perform cross pairing in a list of tuples, the ‘zip’ method, a list comprehension and the ‘==’ operator is used.ExampleBelow is a demonstration of the same −my_list_1 = [('Hi', 'Will'), ('Jack', 'Python'), ('Bill', 'Mills'), ('goodwill', 'Jill')] my_list_2 = [('Hi', 'Band'), ('Jack', 'width'), ('Bill', 'cool'), ('a', 'b')] print("The first list is : " ) print(my_list_1) print("The second list is :") print(my_list_2) my_list_1.sort() my_list_2.sort() print("The first list after sorting is ") print(my_list_1) print("The second list after sorting is ") print(my_list_2) my_result = [(a[1], b[1]) for a, b in zip(my_list_1, my_list_2) if a[0] == b[0]] print("The ... Read More

Network Services Terminology

Bhanu Priya
Updated on 11-Sep-2021 14:47:51

444 Views

The real function of every layer in OSI is to provide services to the layer above it.Network Services TerminologyThe network services terminology is explained below −Entities − In each layer there are so many active elements. An entity can be a software entity or a hardware entity. For example, a software entity is Process and a hardware entity is Intelligent I/O chipPeer Entities − Entities in the same layer on different machines are called peer entities.Service Provider and Service User − The entities in layer N-1 implement a service used by layer N. Layer N-1 is called the Service Provider ... Read More

ISDN Layers in Computer Networks

Bhanu Priya
Updated on 11-Sep-2021 14:46:12

5K+ Views

ISDN is also known as Integrated Services Digital Network. It is helpful in a wide range of services, for example, text (message), image, etc. It is capable of giving services and the foundation of telecommunication networks i.e. useful in the framework.It was also known as Integrated Digital Network because it is a digital technique that is used in switching as well as in transmission.Types of ChannelIt has three types of Channel.B-channelData-rate: 64 kbps.Required: for voice, information which has less data rate.D-channelData-rate: 16-64 kbps.Required: for packet switched data.H-channelData-rate − 1536 kbps or 1920 kbps data rate.Required − for video/ high-speed data ... Read More

What are Analog and Digital Signals

Bhanu Priya
Updated on 11-Sep-2021 14:45:22

19K+ Views

The physical layer’s major function is to move data in the form of electromagnetic signals over a transmission medium. The data which is used by a person is not in a form that can be transmitted over a network.For example, a photograph has to be changed to a form that transmission media can accept. Transmission media works by conducting energy along a physical path.Both data and the signals that represent them can be either Analog or digital in form.Analog DataAnalog data refers to information which is continuous.For Example, an Analog clock which is having hour, minute, and second hands that ... Read More

What is Dense Wavelength Division Multiplexing (DWDM)

Bhanu Priya
Updated on 11-Sep-2021 14:44:48

3K+ Views

Dense wavelength division multiplexing (DWDM) is a technology that multiplexes data signals from different sources so they can share a single optical fibre pair while maintaining complete separation of the data streams.DWDM can handle higher speed protocols up to 100 Gbps per channel. Each channel is only 0.8nm apart. Dense wavelength division multiplexing works on the same principle as CWDM but in addition to the increased channel capacity it can also be amplified to support much longer distances.The diagram given below represents the dense wavelength division multiplexing (DWDM) −Working of DWDMThe working of DWDM is explained below −DWDM modulates multiple ... Read More

Advertisements