Found 34469 Articles for Programming

Get the Number of Characters, Words, Spaces, and Lines in a File using Python

Rohan Singh
Updated on 17-Jul-2023 18:22:34

6K+ Views

Text file analysis is a fundamental task in various data processing and natural language processing applications. Python is a versatile and powerful programming language that provides numerous built−in features and libraries to facilitate such tasks efficiently. In this article, we will explore how to count the number of characters, words, spaces, and lines in a text file using Python. Method 1:Brute Force method In this method, we will develop our own logic in a brute−force manner and take a text file as input and count the number of characters, words, spaces, and lines in the file. In this method, we ... Read More

Get the indices of Uppercase Characters in a given String using Python

Rohan Singh
Updated on 17-Jul-2023 18:24:23

1K+ Views

In Python, we can get the indices of uppercase characters in a given string using methods like using List Comprehension, using a For Loop, using Regular Expressions etc. Finding the indices of Uppercase characters can be useful in text analysis and manipulation. In this article, we will explore different methods to obtain the indices of uppercase characters in a given string. Method 1:Using List Comprehension Using list comprehension we can iterate through the characters of a string, check if they are uppercase using the isupper() method, and stores their indices in a list. It provides a concise and ... Read More

Difference between COMP and COMP3

Pranavnath
Updated on 18-Jul-2023 11:59:03

1K+ Views

In COBOL programming, the COMP and COMP-3 (Pressed Decimal) information representation designs play significant parts in taking care of numeric information. COMP may be a twofold organize that speaks to information in its crude double shape, whereas COMP-3 employments pressed decimal representation with sign and zone digits. The key contrasts between the two lie in their capacity strategies, measure contemplations, utilization scenarios, run confinements, transformation prerequisites, execution suggestions, and meaningfulness What is COMP? COMP may be an information representation arrangement utilized in COBOL (Common Business-Oriented Language) programming. COMP stands for "Computational, " and it is an unsigned double organize that ... Read More

Difference between CORBA and DCOM

Pranavnath
Updated on 18-Jul-2023 11:53:42

404 Views

The world of technology and programming has developed a variety of languages and frameworks, each with its functionality and purpose. This article examines the differences between these two great technologies. In this article, we will the concept of CORBA and DCOM and its difference. CORBA, which has a strong presence in the business field, and DCOM, Microsoft's technology, each have different characteristics. Understanding these differences is important for developers and businesses trying to make informed decisions about their tech stack. What is CORBA? CORBA (Common Object Request Broker Architecture) is a middleware innovation that empowers interoperability and communication between disseminated ... Read More

SCAN (Elevator) Disk Scheduling Algorithm

Pranavnath
Updated on 17-Jul-2023 18:54:32

3K+ Views

In the Operating System, the requests from the input or output of the programs or applications are handled by Disk scheduling algorithms. The System receives countless numbers of requests from different programs and only one request can be processed at a time by the system and all other requests has to wait in queue. The major work of disk scheduling is to increase the performance of the system by reducing seek time, rotating latency, and transfer time. For these processes, different algorithms are used and one among them is SCAN (Elevator). Scan Disk Scheduling Algorithm The Scan Disk Scheduling algorithm ... Read More

Resource Reservation Protocol in Real-time Systems

Pranavnath
Updated on 17-Jul-2023 18:38:07

267 Views

In the OSI (Open Source Interconnection) model, the resource reservation model comes under the fourth layer which is the transport layer protocol. This protocol is particularly used for the purpose of reserving network resources. In RSVP, the resources are associated and maintained by the receiver so it is also known as a receiver-oriented protocol. The Real-time system means the work that has to be delivered to the client within a specific time. In this article, two real-time systems are explained using the resource reservation protocol. Resource Reservation Protocol (RSVP) Definition In networking, Resource Reservation Protocol is used as it provides ... Read More

Differences between Routine and Process

Pranavnath
Updated on 17-Jul-2023 18:33:58

143 Views

A routine is said to be a computer program with a set of instructions that is used for the execution of the system program. They allocate or deallocate the memory used after completion of its execution as per instructions given as routine-routine or even functions. The process is termed as the programs that are currently in execution state and utilizes the resources of CPU. Each process undergoes different states like active, new, ready, block, and wait, suspended during its life cycle. Multiprogramming environment is done to the processes which require it, where each process is classified into preemption and non-preemption ... Read More

Filter Non-None dictionary keys in Python

Tapas Kumar Ghosh
Updated on 17-Jul-2023 18:26:27

279 Views

Python dictionary is one of the most popular data types among the following 4 datatypes. The dictionary defines the key with value pair and doesn’t allow the duplicate. The values are either strings or integers. Sometimes, while working on the dictionary it has some empty values that the None value can fill. For example- when we are working on a machine learning dataset it has found that some of the rows are empty and can be filled by the value None when performing the particular task. In Python, we have some built-in functions like items() and lambda that can be ... Read More

How to Filter list elements starting with a given Prefix using Python?

Tapas Kumar Ghosh
Updated on 17-Jul-2023 18:24:59

545 Views

The term prefix is defined by the beginning of the word or letter. In this article, we will learn how to use Python built-in functions like startswith(), filter(), lambda, and len() to Filter list elements starting with a given Prefix using Python. Let’s take an example to understand this − Let’s take an example to understand this: Given element list, My_list = [“Amelia”, “Kinshuk”, “Rosy”, “Aman”] Keyword to be searched, Prefix = “Am” Final result = [“Amelia”, “Aman”] Syntax The following syntax is used in all the examples − startswith() The is a built-in ... Read More

Python - Filter odd elements from value lists in dictionary

Tapas Kumar Ghosh
Updated on 17-Jul-2023 18:08:28

532 Views

The dictionary is a popular data type in Python that has a key with value pair and doesn’t allow duplicates. To filter the odd elements it has some built-in functions like items(), filter(), lambda, and, the list() will be used to Filter odd elements from value lists in the dictionary. The odd elements of the list are those elements that are not divisible by 2. For example − The given list, [10, 22, 21, 19, 2, 5] After filtering the odd elements from the list: The final result becomes [10, 22, 2] (These are the elements that are divisible by ... Read More

Advertisements