Programming DSA using Python Nptel Week 2 Assignment Answers

Are you looking for the Programming, Data Structures and Algorithms using Python NPTEL Week 2 Assignment Answers 2024 ? You’re in the right place! This guide provides detailed solutions to the Week 2 assignment questions, covering key concepts in Python programming, data structures, and algorithms.

Course Link: Click Here

Table of Contents

Programming, DSA using Python Week 2 Assignment Answers

Programming DSA using Python Week 2 Assignment Answers (July-Dec 2024)

Q1.One of the following 10 statements generates an error. Which one? (Your answer should be a number between 1 and 10.)

x = [[3,5],”mimsy”,2,”borogove”,1] # Statement 1 y = x[0:50] # Statement 2 z = y # Statement 3 w = x # Statement 4 x[1] = x[1][:5] + ‘ery’ # Statement 5 y[1] = 4 # Statement 6 w[1][:3] = ‘fea’ # Statement 7 z[4] = 42 # Statement 8 x[0][0] = 5555 # Statement 9 a = (x[3][1] == 1) # Statement 10

Q2.Consider the following lines of Python code.

b = [43,99,65,105,4] a = b[2:] d = b[1:] c = b d[1] = 95 b[2] = 47 c[3] = 73

Which of the following holds at the end of this code?

a[0] == 47, b[3] == 73, c[3] == 73, d[1] == 47 a[0] == 65, b[3] == 105, c[3] == 73, d[1] == 95 a[0] == 65, b[3] == 73, c[3] == 73, d[1] == 95 a[0] == 95, b[3] == 73, c[3] == 73, d[1] == 95

Answer: a[0] == 65, b[3] == 73, c[3] == 73, d[1] == 95

For answers or latest updates join our telegram channel: Click here to join

These are Programming DSA using Python Week 2 Assignment Answers

Q3. What is the value of endmsg after executing the following lines?

startmsg = “anaconda” endmsg = “” for i in range(1,1+len(startmsg)): endmsg = endmsg + startmsg[-i]

Answer: “adnocana”

Q4. What is the value of mylist after the following lines are executed?

def mystery(l): l = l[2:] return(l)

mylist = [7,11,13,17,19,21] mystery(mylist)

Answer: [7,11,13,17,19,21]

These are Nptel Programming DSA using Python Week 2 Assignment Answers

Programming, Data Structures and Algorithms using Python NPTEL All weeks: Click Here

More Nptel Courses: https://progiez.com/nptel-assignment-answers

Programming DSA using Python Week 2 Assignment Answers (JULY-DEC 2023 )

These are Programming Data Structure And Algorithms Assignment 2 Answers

Q1. One of the following 10 statements generates an error. Which one? (Your answer should be a number between 1 and 10.) x = [“slithy”,[7,10,12],2,”tove”,1] # Statement 1 y = x[0:50] # Statement 2 z = y # Statement 3 w = x # Statement 4 x[0] = x[0][:5] + ‘ery’ # Statement 5 y[2] = 4 # Statement 6 z[4] = 42 # Statement 7 w[0][:3] = ‘fea’ # Statement 8 x[1][0] = 5555 # Statement 9 a = (x[4][1] == 1) # Statement 10

Q2. Consider the following lines of Python code. b = [23,44,87,100] a = b[1:] d = b[2:] c = b d[0] = 97 c[2] = 77 Which of the following holds at the end of this code? a[1] == 77, b[2] == 77, c[2] == 77, d[0] == 97 a[1] == 87, b[2] == 87, c[2] == 77, d[0] == 97 a[1] == 87, b[2] == 77, c[2] == 77, d[0] == 97 a[1] == 97, b[2] == 77, c[2] == 77, d[0] == 97

Answer: a[1] == 87, b[2] == 77, c[2] == 77, d[0] == 97

Q3. What is the value of endmsg after executing the following lines? startmsg = “python” endmsg = “” for i in range(1,1+len(startmsg)): endmsg = startmsg[-i] + endmsg

Answer: python

Q4. What is the value of mylist after the following lines are executed? def mystery(l): l = l[1:] return() mylist = [7,11,13] mystery(mylist)

Answer: [7,11,13]

Assignment Question s

Question 1 A positive integer m is a prime product if it can be written as p×q, where p and q are both primes. Write a Python function primeproduct(m) that takes an integer m as input and returns True if m is a prime product and False otherwise. (If m is not positive, your function should return False.) Here are some examples of how your function should work.

Write a function delchar(s,c) that takes as input strings s and c, where c has length 1 (i.e., a single character), and returns the string obtained by deleting all occurrences of c in s. If c has length other than 1, the function should return s Here are some examples to show how your function should work.

Write a function shuffle(l1,l2) that takes as input two lists, 11 and l2, and returns a list consisting of the first element in l1, then the first element in l2, then the second element in l1, then the second element in l2, and so on. If the two lists are not of equal length, the remaining elements of the longer list are appended at the end of the shuffled output. Here are some examples to show how your function should work.

More Weeks of Programming Data Structure And Algorithms Using Python: Click here

More Nptel Courses: Click here

Programming, DSA using Python Week 2 Assignment Answers (JAN-APR 2023)

Q1. One of the following 10 statements generates an error. Which one? (Your answer should be a number between 1 and 10.)

Q2. Consider the following lines of Python code.

After these execute, which of the following is correct? a. x[2] == 487, y[0] == 397, u[2] == 487, w[0] == 357 b. x[2] == 487, y[0] == 357, u[2] == 487, w[0] == 357 c. x[2] == 487, y[0] == 397, u[2] == 397, w[0] == 357 d. x[2] == 487, y[0] == 357, u[2] == 397, w[0] == 357

Answer: a. x[2] == 487, y[0] == 397, u[2] == 487, w[0] == 357

Q3. What is the value of second after executing the following lines?

Answer: ‘aedsoe’

Q4. What is the value of list1 after the following lines are executed?

Answer: [88, 53, 12, 88, 53, 97, 62]

Assignment Question

1. A positive integer m can be partitioned as primes if it can be written as p + q where p > 0, q > 0 and both p and q are prime numbers. Write a Python function primepartition(m) that takes an integer m as input and returns True if m can be partitioned as primes and False otherwise. (If m is not positive, your function should return False.) Here are some examples of how your function should work.

2. Write a function matched(s) that takes as input a string s and checks if the brackets “(” and “)” in s are matched: that is, every “(” has a matching “)” after it and every “)” has a matching “(” before it. Your function should ignore all other symbols that appear in s. Your function should return True if s has matched brackets and False if it does not. Here are some examples to show how your function should work.

3. A list rotation consists of taking the first element and moving it to the end. For instance, if we rotate the list [1,2,3,4,5], we get [2,3,4,5,1]. If we rotate it again, we get [3,4,5,1,2]. Write a Python function rotatelist(l,k) that takes a list l and a positive integer k and returns the list l after k rotations. If k is not positive, your function should return l unchanged. Note that your function should not change l itself, and should return the rotated list. Here are some examples to show how your function should work.

More Weeks of Programming Data Structure And Algorithms: Click Here

More Nptel courses: https://progiez.com/nptel

Programming DSA using Python Week 2 Assignment Answers(JULY-DEC 2022 )

Answer: c – a[0] == 65, b[3] == 73, c[3] == 73, d[1] == 95

Answer: ‘anaconda’

Assignment Answers

Q1. Write a function intreverse(n) that takes as input a positive integer n and returns the integer obtained by reversing the digits in n. Write a function matched(s) that takes as input a string s and checks if the brackets “(” and “)” in s are matched: that is, every “(” has a matching “)” after it and every “)” has a matching “(” before it. Your function should ignore all other symbols that appear in s. Your function should return True if s has matched brackets and False if it does not. Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.

These ar e Nptel Programming DSA using Python Week 2 Assignment Answers

image

The content uploaded on this website is for reference purposes only. Please do it yourself first.

Instantly share code, notes, and snippets.

@mGalarnyk

mGalarnyk / assignment1.md

  • Download ZIP
  • Star ( 12 ) 12 You must be signed in to star a gist
  • Fork ( 25 ) 25 You must be signed in to fork a gist
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.
  • Learn more about clone URLs
  • Save mGalarnyk/bef0d3194c04e296a6e9784eccdb36f4 to your computer and use it in GitHub Desktop.

R Programming Project 1

github repo for rest of specialization: Data Science Coursera

For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web site.

Although this is a programming assignment, you will be assessed using a separate quiz.

The zip file containing the data can be downloaded here: specdata.zip [2.4MB] Description: The zip file contains 332 comma-separated-value (CSV) files containing pollution monitoring data.

Part 1 ( pollutantmean.R )

Part 2 ( complete.r ), part 3 ( corr.r ).

@SUSANKI

SUSANKI commented Jul 30, 2020

Thank u so much, It's a little bit complicated for me @-@

Sorry, something went wrong.

@Cyberclip

Cyberclip commented Sep 14, 2020

Here it says when I try to do part 1 that there's no package named 'data.table', what should I do?

@harshit229

harshit229 commented Oct 7, 2020

use rstudio

@Romeroc3

Romeroc3 commented Dec 27, 2020 • edited Loading

Thank you very much for this assignment information. I am currently doing my case study on the refugee situation and I need to study data science to analyze the data. Interestingly, the idea for the research came spontaneously when I read https://samplius.com/free-essay-examples/refugee/ in preparation for lesson. These free essay examples got me interested more in migration and globalization issue. Therefore, I decided to do a little research, but I lack the skills to do a high-quality analysis of big data.

@kennethwoanyah

kennethwoanyah commented Feb 3, 2021

@SUSANKI yep, complicated for me too . lol. Works perfectly though.

@flaviaouyang

flaviaouyang commented Feb 18, 2021

you need to install the package. install.packages(data.table)

@Bell-016

Bell-016 commented Feb 23, 2021

I am very frustrated with this course. I took it assuming it will explain things from the beggining for a beginner, but the first assignment to me is unreadble, I would never give this answer because I felt I never learn this things you used for your answer.

@utamadonny

utamadonny commented Mar 16, 2022

i run the corr.R and it return "Error in eval(bysub, parent.frame(), parent.frame()) : object 'ID' not found"

@Rushield

Rushield commented Apr 9, 2022

Bruh this course is just annoying because it ain't show us how to do those things, even understanding your simplified code in a week 2 is damn hard.

@emcdowell28

emcdowell28 commented Dec 15, 2022

You and me both. I've been using multiple other online textbooks to try and gain any kind of fundamental understanding of this material. I don't usually struggle with things like this, but nothing makes me feel more unintelligent than being tested over things we haven't even been taught yet.

  • [Programming Assignment 1] R Programming
  • by Anderson Hitoshi Uyekita
  • Last updated about 2 years ago
  • Hide Comments (–) Share Hide Toolbars

Twitter Facebook Google+

Or copy & paste this link into an email or IM:

IMAGES

  1. R Programming

    coursera r programming week 3 programming assignment 1 quiz answers

  2. week 3 quiz| r programming quiz

    coursera r programming week 3 programming assignment 1 quiz answers

  3. coursera r programming week 3 assignment by Boost My Class

    coursera r programming week 3 programming assignment 1 quiz answers

  4. Coursera Data Analysis with R Programming

    coursera r programming week 3 programming assignment 1 quiz answers

  5. Coursers R programming week 3 Assignment Submission and Program

    coursera r programming week 3 programming assignment 1 quiz answers

  6. Programming Fundamentals week 3 coursera quiz answers|Programming Fundamental week 3 coursera answer

    coursera r programming week 3 programming assignment 1 quiz answers

COMMENTS

  1. R Programming, week (1-4) All Quiz Answers with Assignments

    course link: https://www.coursera.org/learn/r-programming?Friends support me to give you more useful videos.Subscribe me and comment me whatever courses you...

  2. Programming Assignment 3: Quiz >> R Programming

    Programming Assignment 3: Quiz >> R Programming 1. What result is returned by the following code? best ("SC", "heart attack") CAROLINAS HOSPITAL SYSTEMMCLEOD MEDICAL CENTER - DARLINGTONMUSC MEDICAL CENTERMARY BLACK MEMORIAL HOSPITALLAKE CITY COMMUNITY HOSPITALGRAND STRAND REG MED CENTER 2. What result is returned by the following code? best ...

  3. R Programming Quiz 3 (Week 3) John Hopkins Data Science ...

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.

  4. Programming Assignment 3

    ##R Programming - Assignment 3 ####Coursera's Data Science Specialisation. ###Introduction. ... However since the format of the course has changed you do not need to upload the files one by one and instead, you answer questions in a multi choice quiz. Therefore it won't make a difference if you save all functions in a single file.

  5. R Programming

    In this course you will learn how to program in R and how to use R for effective data analysis. You will learn how to install and configure software necessar...

  6. Week 3 Quiz >> R Programming

    Week 3 Quiz >> R Programming. 1. Take a look at the 'iris' dataset that comes with R. The data can be loaded with the code: A description of the dataset can be found by running. There will be an object called 'iris' in your workspace. In this dataset, what is the mean of 'Sepal.Length' for the species virginica? Please round your ...

  7. GitHub

    Languages. R 100.0%. Coursera Quiz & Assignment Answers. Contribute to SivaguruB/Coursera-R-Programming development by creating an account on GitHub.

  8. liuhh02/stanford-algorithms-specialization

    The problem set and programming assignment solutions are uploaded only for reference purposes. Please attempt the quizzes and programming assignments yourself and only look at the explanations if you find that you still can't understand it after consulting the discussion forums and reviewing the lecture content.

  9. GitHub

    R-Programming-Assignment-Week-3. Introduction. This second programming assignment will require you to write an R function is able to cache potentially time-consuming computations. For example, taking the mean of a numeric vector is typically a fast operation. However, for a very long vector, it may take too long to compute the mean, especially ...

  10. R Programming

    In this course you will learn how to program in R and how to use R for effective data analysis. You ... Enroll for free. ... Programming Assignment 1: Quiz ... Module details. We have now entered the third week of R Programming, which also marks the halfway point. The lectures this week cover loop functions and the debugging tools in R. These ...

  11. R Programming Coursera Quiz Answers, Week (1-4) All Quiz ...

    R Programming Coursera Quiz Answers, Week (1-4) All Quiz Answers With Assignment You audit this course free on coursera but if you want certif...

  12. amanchadha/coursera-deep-learning-specialization

    Notes, programming assignments and quizzes from all courses within the Coursera Deep Learning specialization offered by deeplearning.ai: (i) Neural Networks and Deep Learning; (ii) Improving Deep Neural Networks: Hyperparameter tuning, Regularization and Optimization; (iii) Structuring Machine Learning Projects; (iv) Convolutional Neural Networks; (v) Sequence Models - amanchadha/coursera-deep ...

  13. R Programming

    R Pubs. by RStudio. Sign in Register. Ryan Tillis - R Programming - Data Science - Quiz 3 - Coursera. by Ryan Tillis. Last updated almost 8 years ago. Comments (-)

  14. Coursers R programming week 3 Assignment Submission and Program

    This video contains the code for programming assignment-3 and the step by step instructions for submission of assignment which includes forking, cloning repo...

  15. R Programming Programming Assignment 3 (Week 4) John Hopkins Data

    And this course makes me do this for every assignment!!!!! By the way, I have a decent knowledge of programming where I gain from learning Python. I thought this class would be easy for me (after quickly going through the lecture videos), yet from the first assignment I began to scratch my head for an answer.

  16. RPubs

    R Pubs. by RStudio. Sign in Register. R Programming - Week 3 Assignment. by Ken Wood. Last updated almost 4 years ago. Comments (-) Share.

  17. R Programming (JHU Coursera, Course 2)

    R Programming JHU Quiz 1. Week 2 Highlights: Lexical scoping as the reason why all objects must be stored in memory. Programming assignment is useful. As seen below, I have decided to do as much of the specialization in data.table syntax as possible since it is widely used in industry.

  18. R Programming

    The course covers practical issues in statistical computing which includes programming in R, reading data into R, accessing R packages, writing R functions, debugging, profiling R code, and organizing and commenting R code. Topics in statistical data analysis will provide working examples. Week 1: Background, Getting Started, and Nuts & Bolts.

  19. RPubs

    R Pubs. by RStudio. Sign in Register. [Programming Assignment 3] R Programming. by Anderson Hitoshi Uyekita. Last updated about 2 years ago. Comments (-) Share.

  20. Programming in Java Nptel Week 3 Assignment Answers

    These are Programming in Java Nptel Week 3 Assignment Answers. All Weeks of Programming In Java: Click Here. For answers to additional Nptel courses, please refer to this link: NPTEL Assignment . Programming in Java Nptel Week 3 Assignment Answers (Jan-Apr 2024) Course name: Programming In Java. Course Link: Click Here

  21. Programming DSA Using Python Week 2 Assignment Answers

    These are Nptel Programming DSA using Python Week 2 Assignment Answers Write a function delchar(s,c) that takes as input strings s and c, where c has length 1 (i.e., a single character), and returns the string obtained by deleting all occurrences of c in s.

  22. R Programming Programming Assignment 1 (Week 2) John Hopkins Data

    For this first programming assignment you will write three functions that are meant to interact with dataset that accompanies this assignment. The dataset is contained in a zip file specdata.zip that you can download from the Coursera web site. Although this is a programming assignment, you will be assessed using a separate quiz.

  23. RPubs

    R Pubs. by RStudio. Sign in Register. [Programming Assignment 1] R Programming. by Anderson Hitoshi Uyekita. Last updated about 2 years ago.

  24. Data Modeling, Transformation, and Serving

    Week 1 Quiz • 30 minutes; 2 app items • Total 240 minutes. Practice Lab: Data Normalization • 120 minutes; Graded Programming Assignment 1: ... Coursera is one of the best places to go." Chaitanya A. "Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."

  25. Coursera-R-Programming/Week-1/Quiz 1.md at master

    Quiz 1.md. Cannot retrieve latest commit at this time. ####Question 1 R was developed by statisticians working at #####Answer. ####Question 2 The definition of free software consists of four freedoms (freedoms 0 through 3). Which of the following is NOT one of the freedoms that are part of the definition?

  26. GitHub

    Are you looking for NPTEL Week 1 assignment answers for 2024 for July Dec Session ! If you're enrolled in any of the NPTEL courses, this post will help you find the relevant assignment answers for Week 1. Ensure to submit your assignments by August 8, 2024.