Built-in String Functions: Many functions are built into the Python interpreter and are always available. You’ll see a few that work with strings and character data in this lesson: Note: Every string method returns a new string with the modified attributes rather than altering the original string. Following are some of the commonly used string functions: […]
November 24, 2022 | python | No comments
A Python string is a collection of characters enclosed by single, double, or triple quotes. The string is an immutable sequence data type. The computer does not understand the characters; instead, it stores the manipulated character as a combination of 0’s and 1’s internally. Each character is encoded in either ASCII or Unicode. As a […]
November 23, 2022 | python | No comments
What is Armstrong Number? The Armstrong number is a number that is equal to the sum of its digits’ cubes. Armstrong numbers include 0, 1, 153, 370, 371, and 407. Let’s look at why 371 is amrstrong in nature: Approach: The approach is to first count the number of digits (or find the order). Let […]
November 23, 2022 | C++ | No comments
What is Factorial of a number? The product of all positive descending integers is the factorial of n. n! represents the factorial of n. As an example: 4! is pronounced “4 factorial” in this context, and it is also known as “4 bang” or “4 shriek.” The factorial is typically used in Combinations and Permutations […]
November 23, 2022 | C++ | No comments
The classification or categorization of data items is referred to as data types. It represents the type of value that specifies which operations can be performed on a given piece of data. Because everything in Python programming is an object, data types are classes, and variables are instances (objects) of these classes. The data types […]
November 21, 2022 | python | No comments
The largest number that divides two or more numbers is the Greatest Common Divisor (GCD) for those numbers. For example: Let’s say we have two numbers 45 and 27. So, the GCD of 95 and 30 is 5. Program Code: Output: gcd() is a recursive function in the preceding program. It contains two parameters, a […]
November 20, 2022 | C++ | No comments
Two built-in functions in Python are used to perform input and output operations (OI Operations). The two built-in functions for performing output and input operations are listed below. print() – This function is used to output data. input() – This function is used to perform input operations. Take Input from the User: To perform input […]
November 20, 2022 | python | No comments
What exactly is a Python Module? Python modules are files that contain Python definitions and statements. Functions, classes, and variables can all be defined by a module. A module may also contain executable code. Grouping related code into modules makes it easier to understand and use the code. It also helps to organize the code […]
November 18, 2022 | python | No comments
The Fibonacci Series generates the next number by adding two preceding numbers. The Fibonacci sequence begins with two numbers, F0 and F1. F0 and F1 can have initial values of 0 and 1, respectively. For instance, Program Code: Output: Note: also read about Convert Decimal to Binary Follow Me Please follow me to read my latest […]
November 18, 2022 | C++ | No comments
Given a decimal number as input, we need to write a program to convert the given decimal number into an equivalent binary number. Examples: Algorithm for Converting Decimal to Binary: Step 1: Divide the number by 2 and store the remainder in an array (modulus operator). Step 2: Divide the number by 2 using the […]
November 17, 2022 | C++ | No comments