The number of 6-digit even numbers that can be made from the number 214635 are:

Image
The number of 6-digit even numbers that can be made from the number 214635 are:  a) 18 b) 72  c) 120 d) 360 Answer:  D from the question we can see we have to form 6 digit number(no repetition) so, let us six blanks as show below : _ _ _ _ _ _  if the number has to be even it has to be end with even number. 214635   from the above digits even numbers are 2,4,6 so, the units digit is 2 or 4 or 6 so, the no.of.ways is 3 remaining 5 digits can be filled with 5! ways  so, the answer is 5!x3 ways                             = 360 ways  remaini

Python lists

 Our wonderful journey is still continued. 

Please have a watch on the before blog because this blog  is extension to vefore blog  . Have a look at that Previous

Context

Lists 

Operations 

  • Indexing 
  • Slicing 
  • Updating the list
  • Some inbulit functions


PYTHON LISTS 



What is use of lists ?

It is used to make a collection of items. Like in the above pictures.

In this list , we can store in all data types like string, integer etc,.

Syntax :

A = [var1 , var2, var3.. ........]

where, 

A = name of the list 

var1,var2,vars are the elements in the list. 

Eg :

list = ["apples", "banana", "cherry"]

See this video 👇👇👇👇



Lets move on to operations in lists 

Indexing :

Same what we have learnt in strings. 

Previous

Syntax  : 

List[0] # for accessing the first element in list

List[1] # second element




Slicing :

Even this also same as it string.

Previous

Eg : 

list[0:2]  # prints the elements in index 0,1 

   # as we all know second index omitted 



And biggest advantages in list over the string . Lists can be updated at any time in programmme. 

For adding and deleting we have a inbulit functions. 

For adding elements : append function 

For deleting  a element : del function.

Adding a element in list

Code :

          list.append("kiwi")

Deleting a element in list 

Code :

     del list[0] # deleting a element in index '0'



Checking the length of list :

Updated list 

list = ["banana", "cherry" , "kiwi"]

Code :

len(list)

Repeating   a list miltiple times.

Code 

list*2 # repeats the list 2 times 

Concatenation of two lists 

List2 = ["carrots" , "beetroot"] # new list

List + list2



You can also print the maximum and minimum number in list .

Take a new list which will contain numbers

num = [1,4,6,7,5,9]

max(num)

min(num)

Hope this videos are helpful.  comment me for further suggestions. 

Comments

Popular posts from this blog

Python tupes

Python dictonaries

If the sum of 4 times a number A and three times a number B is equal to the sum of number B and seven times the number A, then what is the value of A:B? | CTS previous Aptitude question