NPTEL Programming Data Structures And Algorithms Using Python Assignment 3 Answer

We Discuss About That NPTEL Programming Data Structures And Algorithms Using Python Assignment 3 Answer

NPTEL Programming Data Structures And Algorithms Using Python Assignment Answer – Here All The Questions and Answers Provided to Help All The Students and NPTEL Candidate as a Reference Purpose, It is Mandetory to Submit Your Weekly Assignment By Your Own Understand Level.

Are you looking for the Assignment Answers to NPTEL Programming Data Structures And Algorithms Using Python Assignment 3 Answer? If Yes You are in Our Great Place to Getting Your Solution, This Post Should be help you with the Assignment answer to the National Programme on Technology Enhanced Learning (NPTEL) Course “NPTEL Programming Data Structures And Algorithms Using Python Assignment 3 Answer”

NPTEL Programming Data Structures And Algorithms Using Python Assignment

ABOUT THE COURSE :
This course is an introduction to programming and problem solving in Python.  It does not assume any prior knowledge of programming.  Using some motivating examples, the course quickly builds up basic concepts such as conditionals, loops, functions, lists, strings and tuples.  It goes on to cover searching and sorting algorithms, dynamic programming and backtracking, as well as topics such as exception handling and using files.  As far as data structures are concerned, the course covers Python dictionaries as well as classes and objects for defining user defined datatypes such as linked lists and binary search trees.

INTENDED AUDIENCE: Students in any branch of mathematics/science/engineering, 1st year

PREREQUISITES:          School level mathematics.

INDUSTRY SUPPORT:   This course should be of value to any company requiring programming skills.

Next Week Assignment Answers

SciShowEngineerTelegram

This course can have Associate in Nursing unproctored programming communication conjointly excluding the Proctored communication, please check announcement section for date and time. The programming communication can have a weightage of twenty fifth towards the ultimate score.

Final score = Assignment score + Unproctored programming exam score + Proctored Exam score
  • Assignment score = 25% of average of best 8 assignments out of the total 12 assignments given in the course.
  • ( All assignments in a particular week will be counted towards final scoring – quizzes and programming assignments). 
  • Unproctored programming exam score = 25% of the average scores obtained as part of Unproctored programming exam – out of 100
  • Proctored Exam score =50% of the proctored certification exam score out of 100
YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF ASSIGNMENT SCORE >=10/25 AND
UNPROCTORED PROGRAMMING EXAM SCORE >=10/25 AND PROCTORED EXAM SCORE >= 20/50. 
If any one of the 3 criteria is not met, you will not be eligible for the certificate even if the Final score >= 40/100. 

CHECK HERE OTHERS NPTEL ASSIGNMENTS ANSWERS 

BELOW YOU CAN GET YOUR NPTEL Programming Data Structures And Algorithms Using Python Assignment 3 Answer 2022? :

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

Q1. Write three Python functions as specified below. Paste the text for all three functions together into the submission window. Your function will be called automatically with various inputs and should return values as specified. Do not write commands to read any input or print any output.
any input or print any output.

  • You may define additional auxiliary functions as needed.
  • In all cases you may assume that the value passed to the function is of the expected type, so your function does not have to check for malformed inputs.
  • For each function, there are normally some public test cases and some (hidden) private test cases.
  • “Compile and run” will evaluate your submission against the public test cases.
  • “Submit” will evaluate your submission against the hidden private test cases. There are 15 private test cases, with equal weightage. You will get feedback about which private test cases pass or fail, though you cannot see the actual test cases.
  • Ignore warnings about “Presentation errors”.

  1. Write a function contracting(l) that takes as input a list of integer l and returns True if the absolute difference between each adjacent pair of elements strictly decreases.

    Here are some examples of how your function should work.

      >>> contracting([9,2,7,3,1])
      True
    
      >>> contracting([-2,3,7,2,-1]) 
      False
    
      >>> contracting([10,7,4,1])
      False
    
  2. In a list of integers l, the neighbours of l[i] are l[i-1] and l[i+1]l[i] is a hill if it is strictly greater than its neighbours and a valley if it is strictly less than its neighbours.Write a function counthv(l) that takes as input a list of integers l and returns a list [hc,vc] where hc is the number of hills in l and vc is the number of valleys in l.

    Here are some examples to show how your function should work.

     
    >>> counthv([1,2,1,2,3,2,1])
    [2, 1]
    
    >>> counthv([1,2,3,1])
    [1, 0]
    
    >>> counthv([3,1,2,3])
    [0, 1]
    
    
  3. A square n×n matrix of integers can be written in Python as a list with n elements, where each element is in turn a list of n integers, representing a row of the matrix. For instance, the matrix
      1  2  3
      4  5  6
      7  8  9
    

    would be represented as [[1,2,3], [4,5,6], [7,8,9]].

    Write a function leftrotate(m) that takes a list representation m of a square matrix as input, and returns the matrix obtained by rotating the original matrix counterclockwize by 90 degrees. For instance, if we rotate the matrix above, we get

      3  6  9
      2  5  8    
      1  4  7
    

    Your function should not modify the argument m provided to the function rotate().

    Here are some examples of how your function should work.

     
      >>> leftrotate([[1,2],[3,4]])
      [[2, 4], [1, 3]]
    
      >>> leftrotate([[1,2,3],[4,5,6],[7,8,9]])
      [[3, 6, 9], [2, 5, 8], [1, 4, 7]]
    
      >>> leftrotate([[1,1,1],[2,2,2],[3,3,3]])
      [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
    Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
    JoinScishowEngineerTelegram

Code:-

def contracting(l):
  for z in range(0,len(l)-3):
    A=abs(l[z+2]-l[z+1])
    B=abs(l[z+1]-l[z])
    if A<B:
      continue
    else:
      return (False) 
  return (True)

def counthv(l):
  hill_count,valley_count=0,0
  if len(l)>2:
    for i in range(1,len(l)-1):
      if l[i]>l[i-1] and l[i]>l[i+1]:
        hill_count+=1
      elif l[i]<l[i-1] and l[i]<l[i+1]:
        valley_count+=1
  return ([hill_count,valley_count])
  
def leftrotate(m):
    ans=list()
    for a in range(len(m)):
        ans.append([])
        for b in range(len(m)):
            ans[a].append(m[b][len(m)-a-1])
    return(ans)  

Programming, Data Structures And Algo Using Python Assignment 3 Answers [Jan 2022]

Answers will be Uploaded Shortly and it will be Notified on Telegram, So JOIN NOW
JoinScishowEngineerTelegram

All questions carry equal weightage. All Python code is assumed to be executed using Python3. You may submit as many times as you like within the deadline. Your final submission will be graded.

Note:

  • If the question asks about a value of type string, remember to enclose your answer in single or double quotes.
  • If the question asks about a value of type list, remember to enclose your answer in square brackets and use commas to separate list items.

Q1. Write three Python functions as specified below. Paste the text for all three functions together into the submission window. Your function will be called automatically with various inputs and should return values as specified. Do not write commands to read any input or print any output.

  • You may define additional auxiliary functions as needed.
  • In all cases you may assume that the value passed to the function is of the expected type, so your function does not have to check for malformed inputs.
  • For each function, there are normally some public test cases and some (hidden) private test cases.
  • “Compile and run” will evaluate your submission against the public test cases.
  • “Submit” will evaluate your submission against the hidden private test cases. There are 10 private test cases, with equal weightage. You will get feedback about which private test cases pass or fail, though you cannot see the actual test cases.
  • Ignore warnings about “Presentation errors”.
  1. Define a Python function remdup(l) that takes a nonempty list of integers l and removes all duplicates in l, keeping only the first occurrence of each number. For instance:
  2. Write a Python function sumsquare(l) that takes a nonempty list of integers and returns a list [odd,even], where odd is the sum of squares all the odd numbers in l and even is the sum of squares of all the even numbers in l.
  3. A two dimensional matrix can be represented in Python row-wise, as a list of lists: each inner list represents one row of the matrix. For instance, the matrix

Code:-

def remdup(l):
  L=[]
  for i in l:
    if i not in L:
      L.append(i)
  return(L)

def sumsquare(l):
  odd_sum=0
  even_sum=0
  for a in l:
    if a%2!=0:
      odd_sum+=a*a
    else:
      even_sum+=a*a
  return([odd_sum,even_sum])

def transpose(m):
  ans=list()
  for i in range(len(m[0])):
    a=[]
    for j in range(len(m)):
      a.append(m[j][i])
    ans.append(a)
  return(ans)
Yhaa You have done it but next? if YOU Want to your Others NPTEL Programming Data Structures And Algorithms Using Python Assignment 3 Answer Then Follow US HERE and Join Telegram.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *