Sets in Pyhton

Sets in Pyhton


In python, a set is another type of collection data type. A Set is a mutable and an unordered collection of elements without duplicates. That means the elements within a set cannot be repeated. This feature used to include membership testing and eliminating duplicate elements.

Creating a Set

A set is created by placing all the elements separated by comma within a pair of curly brackets. The set( ) function can also used to create sets in Python.

Syntax:

Set_Variable = {E1, E2, E3 …….. En}

Example

>>> S1={1,2,3,'A',3.14}
>>> print(S1)
{1, 2, 3, 3.14, 'A'}
>>> S2={1,2,2,'A',3.14}
>>> print(S2)
{1, 2, 'A', 3.14}

In the above examples, the set S1 is created with different types of elements without duplicate values. Whereas in the set S2 is created with duplicate values, but python accepts only one element among the duplications. Which means python removed the duplicate value, because a set in python cannot have duplicate elements.

Creating Set using List or Tuple

A list or Tuple can be converted as set by using set( ) function. This is very simple procedure. First you have to create a list or Tuple then, substitute its variable within set( ) function as argument.

Example

MyList=[2,4,6,8,10]
MySet=set(MyList)
print(MySet)

Output:

{2, 4, 6, 8, 10}

Set Operations

As you learnt in mathematics, the python is also supports the set operations such as Union, Intersection, difference and Symmetric difference.

Union: It includes all elements from two or more sets

Positive Numbers: (5, 6, 8, 3, 1)

In python, the operator | is used to union of two sets. The function union( ) is also used to join two sets in python.

Example: Program to Join (Union) two sets using union operator

set_A={2,4,6,8}
set_B={'A', 'B', 'C', 'D'}
U_set=set_A|set_B
print(U_set)

Output:

{2, 4, 6, 8, 'A', 'D', 'C', 'B'}


Example: Program to Join (Union) two sets using union function

set_A={2,4,6,8}
set_B={'A', 'B', 'C', 'D'}
set_U=set_A.
print(set_U)

Output:

{'D', 2, 4, 6, 8, 'B', 'C', 'A'}


(ii) Intersection: It includes the common elements in two sets



Th e operator & is used to intersect two sets in python. Th e function intersection( ) is also used to intersect two sets in python.

Example: Program to insect two sets using intersection operator

set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A & set_B)

Output:

{'A', 'D'}

Example: Program to insect two sets using intersection function

set_A={'A', 2, 4, 'D'}

set_B={'A', 'B', 'C', 'D'}

print(set_A.intersection(set_B))

Output:

{'A', 'D'}

(iii) DifferenceIt includes all elements that are in fi rst set (say set A) but not in the second set (say set B)

Th e minus (-) operator is used to diff erence set operation in python. Th e function difference( ) is also used to diff erence operation.

Example: Program to difference of two sets using minus operator

set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A - set_B)

Output:

{2, 4}

Example: Program to difference of two sets using difference function

set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A.diff erence(set_B))

Output:

{2, 4}

(iv) Symmetric difference : It includes all the elements that are in two sets (say sets A and B) but not the one that are common to two sets.

The caret (^) operator is used to symmetric difference set operation in python. The function symmetric_difference( ) is also used to do the same operation.

Example: Program to symmetric difference of two sets using caret operator

set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A ^ set_B)

Output:

{2, 4, 'B', 'C'}

Example: Program to difference of two sets using symmetric difference function

set_A={'A', 2, 4, 'D'}
set_B={'A', 'B', 'C', 'D'}
print(set_A.symmetric_difference(set_B))

Output:

{2, 4, 'B', 'C'}





Qus. 1 : <p>What will be the output of the following Python code?</p><pre>d = {0, 1, 2}<br>for x in d:<br>&nbsp; &nbsp; print(d.add(x))</pre>

  1. 0 1 2
  2. 0 1 2 0 1 2 0 1 2 …
  3. None None None
  4. None of the mentioned
Qus. 2 : Which of these about a set is not true?

  1. Mutable data type
  2. Allows duplicate values
  3. Data type with unordered values
  4. Immutable data type
Qus. 3 : Which of the following statements is used to create an empty set?

  1. { }
  2. set()
  3. [ ]
  4. ( )
Qus. 4 :

What will be the output of the following Python code?

>>> a={5,4}  >>> b={1,2,4,5}  >>> a<b


  1. {1,2}
  2. True
  3. False
  4. Invalid operation
Qus. 5 : If a={5,6,7,8}, which of the following statements is false?

  1. print(len(a))
  2. print(min(a))
  3. a.remove(5)
  4. a[2]=45
Qus. 6 : If a={5,6,7}, what happens when a.add(5) is executed?

  1. a={5,5,6,7}
  2. a={5,6,7}
  3. Error as there is no add function for set data type
  4. Error as 5 already exists in the set
Qus. 7 :

What will be the output of the following Python code?

>>> a={4,5,6}  >>> b={2,8,6}  >>> a+b


  1. {4,5,6,2,8}
  2. {4,5,6,2,8,6}
  3. Error as unsupported operand type for sets
  4. Error as the duplicate item 6 is present in both sets
Qus. 8 :

What will be the output of the following Python code?

>>> a={4,5,6}  >>> b={2,8,6}  >>> a-b


  1. {4,5}
  2. {6}
  3. Error as unsupported operand type for set data type
  4. Error as the duplicate item 6 is present in both sets
Qus. 9 :

What will be the output of the following Python code?

>>> a={5,6,7,8}  >>> b={7,8,10,11}  >>> a^b


  1. {5,6,7,8,10,11}
  2. {7,8}
  3. Error as unsupported operand type of set data type
  4. {5,6,10,11}
Qus. 10 :

What will be the output of the following Python code?

>>> s={5,6}  >>> s*3


  1. Error as unsupported operand type for set data type
  2. {5,6,5,6,5,6}
  3. {5,6}
  4. Error as multiplication creates duplicate elements which isn’t allowed
Qus. 11 :

What will be the output of the following Python code?

>>> a={3,4,5}  >>> b={5,6,7}  >>> a|b


  1. Invalid operation
  2. {3, 4, 5, 6, 7}
  3. {5}
  4. {3,4,6,7}
Qus. 12 : <p>Is the following Python code valid?</p><pre><span style="font-size: 14px;">a={3,4,{7,5}}<br></span><span style="font-size: 14px;">print(a[2][0])</span></pre>

  1. Yes, 7 is printed
  2. Error, elements of a set can’t be printed
  3. Error, subsets aren’t allowed
  4. Yes, {7,5} is printed
Qus. 13 : Which of these about a frozenset is not true?

  1. Mutable data type
  2. Allows duplicate values
  3. Data type with unordered values
  4. Immutable data type
Qus. 14 :

Is the following Python code valid?

>>> a=frozenset([5,6,7])

>>>

>>> a.add(5)



  1. Yes, now is a {5,5,6,7}
  2. No, frozen set is immutable
  3. No, invalid syntax for add method
  4. Yes, now a is {5,6,7}
Qus. 15 :

What will be the output of the following Python code?

>>> a={3,4,5}

>>> a.update([1,2,3]) 

>>> a



  1. Error, no method called update for set data type
  2. {1, 2, 3, 4, 5}
  3. Error, list can’t be added to set
  4. Error, duplicate item present in list
Qus. 16 :

What will be the output of the following Python code?

>>> a={1,2,3}

>>> a.intersection_update({2,3,4,5}) 

>>> a



  1. {2,3}
  2. Error, duplicate item present in list
  3. Error, no method called intersection_update for set data type
  4. {1,4,5}
Qus. 17 :

What will be the output of the following Python code?

>>> a={1,2,3}

>>> b=a    >>> b.remove(3) 

>>> a



  1. {1,2,3}
  2. Error, copying of sets isn’t allowed
  3. {1,2}
  4. Error, invalid syntax for remove
Qus. 18 :

What will be the output of the following Python code?

>>> a={1,2,3}

>>> b=a.copy()  >>> b.add(4) 

>>> a



  1. {1,2,3}
  2. Error, invalid syntax for add
  3. {1,2,3,4}
  4. Error, copying of sets isn’t allowed
Qus. 19 :

What will be the output of the following Python code?

>>> a={1,2,3}

>>> b=a.add(4) 

>>> b



  1. None
  2. {1,2,3,4}
  3. {1,2,3}
  4. Nothing is printed
Qus. 20 :

What will be the output of the following Python code?

>>> a={1,2,3}

>>> b=frozenset([3,4,5]) 

>>> a-b



  1. {1,2}
  2. Error as difference between a set and frozenset can’t be found out
  3. Error as unsupported operand type for set data type
  4. frozenset({1,2})
Qus. 21 : <p>What will be the output of the following Python code?</p> <pre><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">&gt;&gt;&gt;</span><span style="background-color: rgb(244, 244, 244); color: rgb(51, 51, 51); font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;"=""> a</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">=</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">{</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">5</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">,</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">6</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">,</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">7</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">}<br></span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">&gt;&gt;&gt;</span><span style="background-color: rgb(244, 244, 244); color: rgb(51, 51, 51); font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;"=""> </span><span class="kw2" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" green;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">sum</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">(</span><span style="background-color: rgb(244, 244, 244); color: rgb(51, 51, 51); font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;"="">a</span><span class="sy0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(102,="" 204,="" 102);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">,</span><span class="nu0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" color:="" rgb(255,="" 69,="" 0);="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">5</span><span class="br0" style="font-family: Consolas, Monaco, " lucida="" console",="" monospace;="" text-align:="" justify;="" overflow:="" visible;="" padding:="" 0px;="" border:="" box-shadow:="" none;="" background-image:="" initial;="" background-position:="" background-size:="" background-repeat:="" background-attachment:="" background-origin:="" background-clip:="" overflow-wrap:="" normal;="" margin:="" 0px="" !important;="" line-height:="" 20px="" !important;"="">)</span></pre>

  1. 5
  2. 23
  3. 18
  4. Invalid syntax for sum method, too many arguments
Qus. 22 :

What will be the output of the following Python code?

>>> a={1,2,3}

>>> {x*2 for x in a|{4,5}}



  1. {2,4,6}
  2. Error, set comprehensions aren’t allowed
  3. {8, 2, 10, 4, 6}
  4. {8,10}
Qus. 23 :

What will be the output of the following Python code?

>>> a={5,6,7,8}

>>> b={7,8,9,10} 

>>> len(a+b)



  1. 8
  2. Error, unsupported operand ‘+’ for sets
  3. 6
  4. Nothing is displayed
Qus. 24 :

Is the following Python code valid?

a={1,2,3}

b={1,2,3,4}

c=a.issuperset(b)

print(c)



  1. False
  2. True
  3. Syntax error for issuperset() method
  4. Error, no method called issuperset() exists
Qus. 25 :

What will be the output of the following Python code?

s=set()

type(s)



  1. &lt;’set’&gt;
  2. &lt;class ‘set’&gt;
  3. set
  4. class set
Qus. 26 : Set makes use of __________ Dictionary makes use of ____________

  1. keys, keys
  2. key values, keys
  3. keys, key values
  4. key values, key values
Qus. 27 : Which of the following lines of code will result in an error?

  1. s={abs}
  2. s={4, ‘abc’, (1,2)}
  3. s={2, 2.2, 3, ‘xyz’}
  4. s={san}
Qus. 28 :

What will be the output of the following Python code?

s={2, 5, 6, 6, 7}

s



  1. {2, 5, 7}
  2. {2, 5, 6, 7}
  3. {2, 5, 6, 6, 7}
  4. Error
Qus. 29 :

Write a list comprehension for number and its cube for:

l=[1, 2, 3, 4, 5, 6, 7, 8, 9]



  1. [x**3 for x in l]
  2. [x^3 for x in l]
  3. [x**3 in l]
  4. [x^3 in l]
Qus. 30 :

What will be the output of the following Python code?

s={1, 2, 3}

    s.update(4) 

s



  1. {1, 2, 3, 4}
  2. {1, 2, 4, 3}
  3. {4, 1, 2, 3}
  4. Error
Qus. 31 : Which of the following functions cannot be used on heterogeneous sets?

  1. pop
  2. remove
  3. update
  4. sum
Qus. 32 :

What will be the output of the following Python code?

s={4>3, 0, 3-3}

all(s) 

any(s)



  1. True False
  2. False True
  3. True True
  4. False False
Qus. 33 : Which of the following functions will return the symmetric difference between two sets, x and y?

  1. x | y
  2. x ^ y
  3. x & y
  4. x – y
Qus. 34 :

What will be the output of the following Python code snippet?

  z=set('abc$de')  'a' in z


  1. True
  2. False
  3. No output
  4. Error
Qus. 35 :

What will be the output of the following Python code snippet?

z=set('abc')

  z.add('san')  z.update(set(['p', 'q'])) 

z



  1. {‘abc’, ‘p’, ‘q’, ‘san’}
  2. {‘a’, ‘b’, ‘c’, [‘p’, ‘q’], ‘san}
  3. {‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’}
  4. {‘a’, ‘b’, ‘c’, ‘p’, ‘q’, ‘san’}
Qus. 36 :

What will be the output of the following Python code snippet?

{a**2 for a in range(4)}



  1. {1, 4, 9, 16}
  2. {0, 1, 4, 9, 16}
  3. Error
  4. {0, 1, 4, 9}
Qus. 37 :

. What will be the output of the following Python code?

s1={3, 4}

  s2={1, 2}  s3=set()  i=0  j=0  for i in s1:      for j in s2:          s3.add((i,j))          i+=1          j+=1 

print(s3)



  1. {(3, 4), (1, 2)}
  2. Error
  3. {(4, 2), (3, 1), (4, 1), (5, 2)}
  4. {(3, 1), (4, 2)}
Qus. 38 : The ____________ function removes the first element of a set and the last element of a list.

  1. remove
  2. pop
  3. discard
  4. dispose
Qus. 39 : If we have two sets, s1 and s2, and we want to check if all the elements of s1 are present in s2 or not, we can use the function:

  1. s2.issubset(s1)
  2. s2.issuperset(s1)
  3. s1.issuperset(s2)
  4. s1.isset(s2)
Qus. 40 :

What will be the output of the following Python code, if s1= {1, 2, 3}?

s1.issubset(s1)



  1. True
  2. Error
  3. No output
  4. False
Qus. 41 : <p>What is the output of the following code?</p><pre>a = set('dcma')<br>b = set('mlpc')<br>print(a^b)</pre><div><br></div>

  1. {‘d’, ‘c’, ‘m’, ‘l’, ‘p’, ‘c’}
  2. {‘m’, ‘l’, ‘p’, ‘c’}
  3. {‘d’, ‘c’, ‘m’, ‘a’}
  4. None of These
Qus. 42 : Which one the following is a mutable data type ?

  1. set
  2. tuple
  3. string
  4. None of These

Programs

python program to find the 2nd largest number from the list of the numbers entered through keyboard.

View Solution


python program that creates a list of numbers from 1 to 20 that are divisible by 4

View Solution


python program to define a list of countries that are a member of BRICS Check whether a county is member of BRICS or not

View Solution


Python program to read marks of six subjects and to print the marks scored in each subject and show the total marks

View Solution


Python program to read prices of 5 items in a list and then display sum of all the prices product of all the prices and find the average

View Solution


Python program to count the number of employees earning more than 1 lakh per annum

View Solution


python program to create a list of numbers in the range 1 to 10 Then delete all the even numbers from the list and print the final list

View Solution


python program to generate in the Fibonacci series and store it in a list Then find the sum of all values

View Solution


python program to swap two values using tuple assignment

View Solution


python program using a function that returns the area and circumference of a circle whose radius is passed as an argument

View Solution


python program that has a list of positive and negative numbers Create a new tuple that has only positive numbers from the list

View Solution


Python Program that generate a set of prime numbers and another set of even numbers

View Solution


python program to find minimum element from a list of elements along with its index in the list

View Solution


Python program to calculate mean of a given list of numbers

View Solution


Python program to search for an element in a given list of numbers

View Solution


python program to count frequency of a given element in a list of numbers

View Solution


python program to calculate the sum of integers of the list

View Solution


python program to reverses an array of integers

View Solution


python program to creates a third list after adding two lists

View Solution


python program to store the product information in dictionary

View Solution


python program to create a dictionary whose keys are month names and values are their corresponding number of days

View Solution


python program that input a list, replace it twice and then prints the sorted list in ascending and descending order

View Solution


python program to check if the maximum element of the list lies in the first half of the list or in the second half

View Solution


python program to display the maximum elements from the two list along with its index in its list

View Solution


python program to swap list elements with even and locations

View Solution


python program to rotate list elements with next elements

View Solution


python program to find maximum and minimum values in tuple

View Solution


python program to interchange the values of two tuple

View Solution


python program to interchange the values of two tuple

View Solution


python program to increment the elements of list

View Solution


python program to enter a list containing number between 1 and 12 then replace all the entries in the list that are greater than 10 with 10

View Solution


python program that reverse the list of integers in place

View Solution


python program to input two list and create third list which contains all elements of the first elements followed by all elements of second list

View Solution


python program to inter list of string and create a new list that consist of those strings with their first characters removed

View Solution


python program to create a list using for loop which consist of integers 0 through 49

View Solution


python program to create a list using for loop which consist square of the integers 1 through 50

View Solution


python program to create a list using for loop which consist a bb ccc dddd that ends with 26 copies of the letter z.

View Solution


python program that takes any two list L and M of the same size and adds their elements together in another third list

View Solution


python program to rotates the elements of list so that fist elements move to second and second to the third

View Solution


python program to move all duplicate element to the end of list

View Solution


python program to display the maximum and minimum values form specified range of indexes of a list

View Solution


python program to compare two equal sized list and print the first index where they differ

View Solution


python program to enter names of employees and their salaries as input and store them in a dictionary

View Solution


python program to count the number of times a character appears in a given string

View Solution


python program to convert a number entered by the user into its corresponding number in words

View Solution


python program Repeatedly ask the user to enter a team name

View Solution


python program that repeatedly asks the user to enter product names and prices

View Solution


Python Program to Create a dictionary whose keys are month name and whose values are number of days in the corresponding month

View Solution


python program to store the detail of 10 students in a dictionary at the same time

View Solution


python program to Create a dictionary with the opposite mapping

View Solution


python program that lists the over lapping keys of the two dictionaries if a key of d1 is also a key of d2 the list it

View Solution


python program that checks if two same values in a dictionary have different keys

View Solution


python program to check if a dictionary is contained in another dictionary

View Solution


python program to create a new dictionary D2 having same keys as D1 but values as the sum of the list elements

View Solution


python program to create a dictionary has three keys assets liabilities and capital

View Solution


python program that create a tuple storing first 9 terms of Fibonacci series

View Solution


python program that receives the index and return the corresponding value

View Solution


Python program that receives a Fibonacci series term and returns a number telling which term it is

View Solution


python program to create a nested tuple to store roll number name and marks of students

View Solution


python program that interactively creates a nested tuple to store the marks in three subjects for five students

View Solution


Python Program to accept three distinct digits and print all possible combinations from the digits

View Solution


Python Program to find the successor and predecessor of the largest element in list

View Solution


Python function that takes a string as parameter and returns a string with every successive repetitive character replaced

View Solution


CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad