**NPTEL The Joy of Computing using Python Assignment 4 Answers 2023:-** All the Answers are provided here to help the students as a reference, You must submit your assignment at your own knowledge.

## NPTEL The Joy Of Computing Using Python Week 4 Assignment Answer 2023

**1. What is a magic square?**

A square grid of letters

A square grid of numbers where the sum of the rows, columns, & diagonals are equal

A special kind of card trick

A term used in cryptography

Answer :- For AnswerClick Here

**2. In a 3×3 magic square, what is the magic constant?**

- 3
- 6
- 9
- 15

Answer :-For AnswerClick Here

**3. Which of the following is NOT a property of a magic square?**

- The sum of each row is equal
- The sum of each column is equal
- The sum of each diagonal is equal
- The sum of each individual element is equal

Answer :-For AnswerClick Here

**4. What will be the output of the following code?**

- A magic square of size 2.
- A magic square of size n.
- A magic square of an even size.
- A magic square of an odd size.

Answer :-For AnswerClick Here

**5. What will be the output of the following code?**

- Sorted List(L) containing random elements between 0-10 in descending order.
- Sorted List containing random elements between 0-10 in ascending order.
- Sorted List containing elements between 0-10.
- Sorted List containing elements between 0-9 in ascending order.

Answer :-For AnswerClick Here

**6. Which code will generate all prime numbers between 0-100?**

Answer :-For AnswerClick Here

**7. In the birthday paradox, as the number of people in a group increases, what happens to the probability that two people share a birthday?**

- It increases
- It decreases
- It stays the same
- It becomes impossible

Answer :-For AnswerClick Here

**8. Which module is used to generate random numbers in Python?**

- math
- random
- stats
- numpy

Answer :-For AnswerClick Here

**9. Which function is used to shuffle a list in Python?**

- random.shuffle()
- shuffle()
- list.shuffle()
- random_list()

Answer :-For AnswerClick Here

**10. What is the output of the following code? **

import random

nums = [1, 2, 3, 4, 5]

random.shuffle(nums)

print(nums)

- [1, 2, 3, 4, 5]
- [5, 4, 3, 2, 1]
- A random ordering of the numbers 1 through 5
- An error

Answer :-For AnswerClick Here

Course Name | The Joy Of Computing Using Python |

Category | NPTEL Assignment Answer |

Home | Click Here |

Join Us on Telegram | Click Here |

## NPTEL The Joy of Computing using Python Assignment 4 Answers [July 2022]

**1. Which of the following statements are true regarding the Magic Squares? (N = Number of rows or columns)**

a. A Magic Square is always a square matrix.

b. A Magic Square can or cannot be a square matrix.

c. The Sum of each row and each column is N(N+1)/2

d. The Sum of each row and each column is N(N

^{2}+1)/2.

Answer:-a, d

**2. What will be the output of the following code?**

a. This is a sentence.

b. Error

c. No output

d. The program will not run

Answer:-c

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

**3. A perfect number is a number in which the sum of its proper divisors is equal to that number. For example, 6 is a perfect number as the sum of its divisors 1,2,3 is equal to 6. Which function returns True if the number is perfect?**

Answer:-a

**4. Suppose there is a movie with 3 letters, how many combinations of names are possible?**

a. 26

b. 676

c. 17576

d. 456976

Answer:-c

**5. What are the possible outputs of the following program?**

a. Any number in the range between 0,4 (Both inclusive).

b. Any number in the range between 1,4 (Both inclusive).

c. Any number in the range between 0,5 (Both inclusive).

d. Any number in the range between 1,5 (Both inclusive).

Answer:-a

**6. Birthday Paradox can be simulated with approximately __________ people.**

a. 365

b. 100

c. 40

d. 20

Answer:-For Answer Click Here

👇**For Week 05 Assignment Answers**👇

**7. What is the command to print the last result of the ipython console?**

a. ‘’

b. –

c. _

d. \\

Answer:-c

**8. What will be the output of the following program?**

a. Passenger, Starwars

b. spiderman, jumanji

c. spiderman, jumanji, Passenger, Starwars?

d. spiderman, Starwars

Answer:-b

**9. In the ‘Dobble Game’, if there are 8 objects on 1 card and 10 objects on another, how many comparisons are possible?**

a. 8

b. 10

c. 18

d. 80

Answer:-d

**10. What will be the output of the following code?**

a. Display the number of consonants and name of the movie.

b. Display the number of letters and name of the movie.

c. Display the number of vowels and name of the movie.

d. Display the number of special characters and name of the movie.

Answer:-c

**For More NPTEL Answers:- CLICK HERE****Join Our Telegram:- CLICK HERE**

Disclaimer:- We do not claim 100% surety of solutions, these solutions are based on our sole expertise, and by using posting these answers we are simply looking to help students as a reference, so we urge do your assignment on your own.

## NPTEL The Joy of Computing using Python Assignment 4 Programming Solutions July 2022

**Q1. Take two numbers N and K as an input. Create a list L of length N and initialize it with zeros. Change the value to 1 of even indexes if k is even, otherwise change the value of odd indexes. Print list L in the end.(Consider 0 as even)****Code:-**

```
N=int(input())
K=int(input())
L=[]
if K%2!=0:
for x in range(N):
if x%2==0:
L.append(0)
else:
L.append(1)
else:
for x in range(N):
if x%2!=0:
L.append(0)
else:
L.append(1)
print(L,end="")
```

**Q2. Write a program to take string S as an input and replace all vowels by *. Also print the modified string.Code:-**

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

**Q3. Write a program to take an integer N as an input and display the pattern.Code:-**

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

## What is The Joy Of Computing Using Python?

The Joy Of Computing Using Python is a fun-filled whirlwind tour of 30 hrs, covering everything you need to know to fall in love with the most sought-after skill of the 21st century. This course includes examples of analytics in a wide variety of industries, and we hope that students will learn how you can use analytics in their careers and life. One of the most important aspects of this course is that you, the student, are getting hands-on experience creating analytics models; we, the course team, urge you to participate in the discussion forums and to use all the tools available to you while you are in the course!

**CRITERIA TO GET A CERTIFICATE**

Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.

Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

**YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.**

NPTEL The Joy of Computing using Python | Answers |

Assignment 1 | Click Here |

Assignment 2 | Click Here |

Assignment 3 | Click Here |

Assignment 4 | Click Here |

Assignment 5 | Click Here |

Assignment 6 | NA |

Assignment 7 | NA |

Assignment 8 | NA |

Assignment 9 | NA |

Assignment 10 | NA |

Assignment 11 | NA |

Assignment 12 | NA |

## NPTEL The Joy Of Computing Using Python Assignment 4 Solutions Jan 2022

**Q1. What will be the output of the following code?**

(A) A magic square of size 2.

(B) A magic square of size n.

(C) A magic square of an even size.

(D) A magic square of an odd size.

**Answer:- (B) A magic square of size n.**

**👇FOR NEXT WEEK ASSIGNMENT ANSWERS👇**

**Q2. What is the correct code to display whether the entered year is a leap year or not?**

(A)

(B)

(C)

(D)

**Answer:- (D) **

**Q3. What the following code will do?**

(A) Print unique movies of list L1

(B) Print unique movies of list L2

(C) Print common movies of lists L1 and L2

(D) Shows an error

**Answer:- (A) Print unique movies of list L1**

**Q4. What will be the output of the following code?**

(A) Displays the number of consonants and the name of the movie.

(B) Displays the number of letters and the name of the movie.

(C) Displays the number of vowels and the name of the movie.

(D) Displays the number of special characters and the name of the movie.

**Answer:- (C) Displays the number of vowels and the name of the movie.**

**Q5. What will be the output of the following code?**

(A) Print all perfect squares with square roots between 5-20 and divisible by 5.

(B) Print all perfect squares with square roots between 5-20 and not divisible by 5.

(C) Print all perfect squares with square roots between 5-19 and not divisible by 5.

(D) Print all perfect squares with square roots between 5-19 and divisible by 5.

**Answer:- (D) Print all perfect squares with square roots between 5-19 and divisible by 5.**

**Q6. What is the code to generate all prime numbers between 0-100?**

(A)

(B)

(C)

(D)

**Answer:- (B)**

**Q7. What is code to replace all the letters of a movie name except special(‘-’, ‘White spaces’, etc) characters with * in a single line.**

(A)

(B)

(C)

(D)

**Answer:- (D) **

**👇FOR NEXT WEEK ASSIGNMENT ANSWERS👇**

**Q8. What’s the output of the following code?**

(A) List of squares of even numbers.

(B) List of squares of numbers between 0-10

(C) List of squares of numbers between 0-9.

(D) List of squares of odd numbers.

**Answer:- (A)**

**Q9. What’s the correct code to calculate the sum of series 1 + (1+2) + (1+2+3) + (1+2+3+4) + …. + n terms.**

(A)

(B)

(C)

(D)

**Answer:- For Answer Click Here**

**Q10. A perfect number is a number in which the sum of divisors is equal to that number. For example, 6 is a perfect number as a sum of its divisors 1,2,3 is equal to 6. Which function returns True if the number is a perfect number?**

(A)

(B)

(C)

(D)

**Answer:- (A)**

**👇FOR NEXT WEEK ASSIGNMENT ANSWERS👇**

**Disclaimer**:- We do not claim 100% surety of solutions, these solutions are based on our sole expertise, and by using posting these answers we are simply looking to help students as a reference, so we urge do your assignment on your own.

**For More NPTEL Answers:- CLICK HERE**

**Join Our Telegram:- CLICK HERE**

**NPTEL The Joy of Computing using Python Assignment 4 Answers 2022:-** All the Answers provided here to help the students as a reference, You must submit your assignment at your own knowledge.

## 5 thoughts on “NPTEL The Joy Of Computing Using Python Assignment 4 Answers”