- 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
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
752 Views
is and equals(==) operators are mostly same but they are not same. is operator defines if both the variables point to the same object whereas the == sign checks if the values for the two variables are the same. Example Code # Python program to # illustrate the # difference between # == and is operator # [] is an empty list list1 = [] list2 = [] list3=list1 if (list1 == list2): print("True") else: print("False") if (list1 is list2): print("True") else: print("False") if (list1 is list3): print("True") else: print("False") Output True False True
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
74 Views
Given a 26 letter character set, here we are using a new character set. And another character set just like alphabet set (a, b, c........z), then our task is to make a relation between new character set and that alphabet set. Example New character set: qwertyuiopasdfghjklzxcvbnm Input: "wwmm" Output: bbzy Algorithm Step 1: Given a new character set and input the string to make a relation. Step 2: and the original character set also given below. Step 3: Create a dictionary, we use here map technique, we map the English character set and new given character set, ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
565 Views
Given two numbers. Our task is to check whether they are anagrams of each other or not in binary representation. We can solve this problem quickly in python using Counter (iterable) method and Dictionary Comparison. Examples Input: a = 8, b = 16 Output : Yes Binary representations of both numbers have same 0s and 1s. Algorithm Step 1 : Given two numbers. Step 2 : Convert both number into its binary using bin() function and remove first two characters because of bin(). Step 3 : Since binary representation of both numbers could differ in length ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
196 Views
Given a number n, print m multiplies of n without using any loop. Here we use recursive function. Examples Input: n = 15 Output: 15 10 5 0 5 10 15 Algorithm Step 1: Given n. Step 2: If we are moving back toward the n and we have reached there, then we are done. Step 3: If we are moving toward 0 or negative. Step 4: If m is greater, then 5, recursive function with true flag else recursive function is false. Step 5: If m is not greater than 5 then flag is false. ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
1K+ Views
In set theory, the complement of a set A refers to elements not in A. the relative complement of A with respect to a set B, also termed the difference of Sets A and B. We just apply this principle here. Python has difference function. Algorithm Step 1 : first we create two user input list. A & B Step 2 : Insert A and B to a set. Step 3 : for finding the missing values of first list we apply difference function, difference of B from A. Step 4 : for finding the Additional ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
314 Views
Given a sentence. Our task is to check whether this sentence is pan grams or not. The logic of Pan grams checking is that words or sentences containing every letter of the alphabet at least once. To solve this problem we use set () method and list comprehension technique. Example Input: string = 'abc def ghi jkl mno pqr stu vwx yz' Output: Yes // contains all the characters from ‘a’ to ‘z’ Input: str='python program' Output: No // Does not contains all the characters from ‘a’ to 'z' Algorithm Step 1: create a string. Step 2: ... Read More
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
2K+ Views
This function is use to extract k bits from pos position and returns the extracted value. Here we use python slicing technique. Example Input:: number=170 K=5 Pos=2 Output=21 Algorithm Extractionbit(no, k, pos) /*user input number is stored in variable no, extracted bit is stored in variable k and the position of bit is pos. */ Step 1 : first convert the number into its binary form using bin(). Step 2 : remove the first two character. Step 3 : then extracting k bits from starting ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
3K+ Views
Here we use python built in function. First we split the sentence into a list of word. Then reverse each word and creating a new list ,here we use python list comprehension technique and last joining the new list of words and create an new sentence. Example Input :: PYTHON PROGRAM Output :: NOHTYP MARGORP Algorithm Step 1 : input a sentence. And store this in a variable s. Step 2 : Then splitting the sentence into a list of words. w=s.split(“”) Step 3 : Reversing each word and creating a new list of ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
1K+ Views
In this problem given two lists. Our tasks is to display difference between two lists. Python provides set() method. We use this method here. A set is an unordered collection with no duplicate elements. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference. Example Input::A = [10, 15, 20, 25, 30, 35, 40] B = [25, 40, 35] Output: [10, 20, 30, 15] Explanation difference list = A - B Algorithm Step 1: Input of two arrays. Step 2: convert the lists into sets explicitly. Step 3: simply reduce one ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
1K+ Views
Given an integer array. The elements of the array may be duplicate.Our task is to display the distinct values. Example Input::A=[1, 2, 3, 4, 2, 3, 5, 6] Output [1, 2, 3, 4, 5, 6] Algorithm Step 1: input Array element. Step 2: Then pick all the elements one by one. Step 3: then check if the picked element is already displayed or not. Step 4: use one flag variable which initialized by 0.if the element is displayed earlier flag variable is 1 and if the element is not displayed earlier flag variable is 0. ... Read More