Are you looking for help in Joy of Computing using Python NPTEL week 4 Assignment Answers?

So, here in this article, we have provided Joy of Computing using Python week 4 Assignment Answer’s hint.

Table of Contents

## NPTEL The Joy of Computing using Python Assignment Answers Week 4

**Q1. Which of the following statements are true with regards to magic square?**

**Answer**: a. The sum of each row should be m.

b. The sum of each column should be m.

c. The sum of each diagonal should be m.

**1000+ students getting help from instant notifications, Join us on telegram.**

**Q2. Which of the following statements hold true about N in the magic square? N denotes the number of rows and columns in the square.**

**Answer**: b. N should be odd.

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

**Answer:** a. A Magic Square is always a square matrix.

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

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

```
'''
This is a sentence
'''
```

**Answer:** c. No output

**Q5. Which of the following operator is used to raise the exponent to a number?**

**Answer:** c. **

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

**Answer:** c. 17576

**Q7. What should be the value of a, b, c, d respectively?**

**Answer:** c. 1,7,3,9

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

```
L1 = ['harry potter', 'matrix', 'spiderman', 'avengers', 'john wick']
L2= ['drishyam', 'spiderman','bahubali', 'dhoom', 'race', 'matrix']
L = []
for i in range(len(L1)):
flag = 0
for j in range(len(L2)):
if(L1[i]== L2[j]):
flag = 1
break
else:
flag = 0
if(flag == 0):
L.append(L1[i])
print(L)
```

**Answer:** a. Print unique movies of list L1

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

```
for i in range(5,20):
if(i%5 == 0):
print(i**2)
```

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

**Q10. A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For example, 6 is a perfect number as the sum of its divisors 1,2,3 is equal to 6.Which function will return True if the number is a perfect number?**

**Answer:** Option A

```
def perfect_number(num):
ans=0
for i in range(1, num):
if(num%i==0):
ans ans + i
if(ans==num):
return True
else:
return False
```

### Joy of Computing using Python Programming Answers Week 4

Q1.

```
n=int(input())
ans=0
for i in range(1,n+1):
ans+=i**2
print(ans,end="")
```

Q2.

```
n=int(input())
print(2**n,end="")
```

Q3.

```
n=int(input())
max_row=1
max_row1=1
for row in range(1,n+1):
b=0
for space in range(1,n-row+1):
print(" ",end="")
a=row
Left=list()
while(a!=max_row1):
if a>9:
Left.append(str(b))
b=b+1
else:
Left.append(str(a))
a=a+1
if row==n:
print(("".join(Left)+str(max_row)+"".join(Left[::-1])),end="")
else:
print(("".join(Left)+str(max_row)+"".join(Left[::-1])))
if (max_row+2>9):
max_row=-1
max_row+=2
max_row1+=2
```

TELEGRAM FOR NOTIFICATION | Click Here |

Follow on Google News (in one click) | Click Here |

**Disclaimer:** These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.

**Also Available:**

NPTEL The Joy of Computing using Python Assignment Answers Week 3

NPTEL The Joy of Computing using Python Assignment Answers Week 5