- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34494 Articles for Programming
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
976 Views
We will see how to count occurrences of an element in a Tuple. A tuple is a sequence of immutable Python objects. Let’s say we have the following input, with the occurrences of 20 to be checked − myTuple = (10, 20, 30, 40, 20, 20, 70, 80) The output should be − Number of Occurrences of 20 = 3 Count occurrence of an element in a Tuple using for loop In this example, we will count the occurrences of an element in a Tuple − Example def countFunc(myTuple, a): count = 0 for ele in myTuple: ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
We will count the number of vowels using set in a given string. Let’s say we have the following input − jackofalltrades The output should be the following, counting the number of vowels − 65 Count the number of vowels using set in a given string We will count the number of vowels using set in a give string − Example def vowelFunc(str): c = 0 # Create a set of vowels s="aeiouAEIOU" v = set(s) # Loop to traverse the alphabet in the given string for alpha in str: # If alphabet is present # in ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
10K+ Views
Vowels are the alphabets a, e, i, o, u. All the rest of the alphabets are known as consonants.The program to check if a character is a vowel or consonant is as follows −Example Live Demo#include using namespace std; int main() { char c = 'a'; if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ) cout
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
12K+ Views
A number is even if it is divisible by two and odd if it is not divisible by two.Some of the even numbers are −2, 4, 6, 8, 10, 12, 14, 16Some of the odd numbers are −1, 3, 5, 7, 9, 11, 13, 15, 17Check Whether Number is Even or Odd using ModulusA program to check whether number is even or odd using modulus is as follows.Example Live Demo#include using namespace std; int main() { int num = 25; if(num % 2 == 0) cout
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
To check if two lists have at least one common element, we will loop through list1 and list2 and check for atleast one common element in both the lists. The list is the most versatile datatype available in Python, which can be written as a list of comma-separated values (items) between square brackets. Important thing about a list is that the items in a list need not be of the same type. Let’s say we have the following inputs i.e. 2 lists − [15, 45, 67, 30, 98] [10, 8, 45, 48, 30] The output should be the following ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
2K+ Views
There are two ways to create a program to swap two numbers. One involves using a temp variable and the second way does not use a third variable. These are explained in detail as follows −Program to Swap Two Numbers using temp VariableThe program to swap two numbers using a temp variable is as follows.Example Live Demo#include using namespace std; int main() { int a = 10, b = 5, temp; temp = a; a = b; b = temp; cout
![Sarika Singh](https://www.tutorialspoint.com/assets/profiles/502778/profile/60_2211036-1660719373.jpg)
2K+ Views
This article will teach you how to determine whether a string contains a URL or not. In Python, strings are collections of bytes that represent Unicode characters. You can use single or double quotes and everything enclosed in them is considered as a string. When given a string, we will first determine whether it contains a URL. If one is found, we will then print the URL. Using findall() method We will employ Python's regular expression concept to resolve this issue. Regular expressions are supported by the Python re package. Using a particular syntax defined in a pattern, a regular ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
3K+ Views
Data Types in C++There are many data types in C++ but the most frequently used are int, float, double and char. Some details about these data types are as follows −int - This is used for integer data types which normally require 4 bytes of memory space.float - This is used for storing single precision floating point values or decimal values. float variables normally require 4 bytes of memory space.double - This is used for storing double precision floating point values or decimal values. Double variables normally require 8 bytes of memory space.char - This is used for storing characters. ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
9K+ Views
Quotient and Remainder are parts of division along with dividend and divisor.The number which we divide is known as the dividend. The number which divides the dividend is known as the divisor. The result obtained after the division is known as the quotient and the number left over is the remainder.dividend = divisor * quotient + remainderFor Example: If 15 is divided by 7, then 2 is the quotient and 1 is the remainder. Here, 15 is the dividend and 7 is the divisor.15 = 7 * 2 + 1A program to find quotient and remainder is as follows:Example Live Demo#include ... Read More