Posts

Linked list 4

Image
      Linked List  (interview questions)   You have been given a linked list of integers. Your task is to write a function that deletes a node from a given position, 'POS'. Note : Assume that the Indexing for the linked list always starts from 0. If the position is greater than or equal to the length of the linked list, you should return the same linked list without any change. Illustration : The following images depict how the deletion has been performed. Image-I : Image-II : Detail explanations : input format : The first line contains the elements of the linked list separated by a single space. The second line contains the integer value of 'POS'. It denotes the position in the linked list from where the node has to be deleted.  Remember/Consider : While specifying the list elements for input, -1 indicates the end of the singly linked list and hence, would never be a list element Output format : Print the resulting linked list of integers in a row, separated by a sin

IFELSE IN PYTHON

Image
   ALL ABOUT IF-ELSE IN PYTHON THIS IS CODE OF IF-ELSE IN PYTHON YOU CAN COPY PASTE THIS CODE AND RUN  AND SEE THE OUTPUT IN THIS CODE I HAVE COVER ALMOST WORK RELATED   TO IF-ELSE. ''' Equal : a==b not equal: a!=b less than: a<b greater than :b>a greater than or equal to :a>=b less than equal to: a<=b ''' # if statement a = 33 b = 200 if b > a : print ( "b is geater than a" ) # # elif a = 33 b = 33 if b > a : print ( "b is greater than a" ) elif a == b : print ( "a and b are equal" ) # # ELSE a = 200 b = 33 if b > a : print ( "b is greater than a" ) elif a == b : print ( "a is greater than b" ) else : print ( "a is greater than b" ) # # SHORT HAND IF a = 300 b = 30 if a > b : print ( "a is greater than b " ) # # SHORT HAND IF ELSE a = 2 b = 330 print ( "A" ) if a > b else print ( "B" )