Sorry, you do not have permission to ask a question, You must login to ask a question.

# NPTEL The Joy of Computing using Python Assignment Answers Week 3 2023

Are you looking for help in Joy of Computing using Python NPTEL Week 3 Assignment Answers? So, here in this article, we have provided Joy of Computing using Python week 3 Assignment Answer’s hint.

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

Q1. ___________ is the method to insert an item into a specified position in a list.

Q2. Which method returns the number of occurrences of an element in a list.

Q3. The function random.randint(1,100) in python generates.

Answer: a. A random integer between 1 to 100 with 1 and 100 both inclusive

Q4. The method open(“file1.txt”, r+) opens the file file1.txt in _____

Q5. Consider the list L= [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]. What will be the output of the statement L [3:6]?

Q6. What is the output of this code?

``````a, b=1,0
a=a^b
b=a^b
a=a^b
print(a)``````

Q7. What is the output of the following code?

``````def foo(l):
a = l
for i in l:
if i < a:
a = i
return a
print (foo([2, 3, 5, 1, 7, 6]))``````

Q8. What is the output of the following code?

``````def bar(string):
left = 0
right = len(string) - 1
while(left < right):
if(string[left] != string[right]):
return False
left += 1
right -= 1
return True
print(bar("telugu"))
print(bar("malayalam"))``````

Q9. Explain what the output will be when the code given below is executed.

``````def func(list1):
while (len(list1) > 2):
k=list1 
for i in list1:
if k<i:
k=i
list1.remove (k)
j=list1
for i in list1:
if j>i:
j=i
list1.remove (j)
return list1
list2=func ([1,4,3,6,5,3,7,8,9,4])
#sum is a function which returns the sum of all of the values of all the elements of a list
print(sum(list2)/len (list2))``````

Q10. Which among the following statements is True with respect to the code given below?

``````count = 0
for i in range(10):
for j in range(5):
count += i *j
print(count)
``````

## The Joy of Computing using Python Programming Assignment Answers

Q1.

``````N=int(input())
for i in range(1,N+1):
for j in range(1,i+1):
print("* ",end="")
if j!=N:
print()``````

Q2.

``````N=int(input())
L=[0,1]
if N==1:
print(0)
elif N==2:
print(0)
print(1)
else:
print(0)
print(1)
for i in range(N-2):
if i==N-3:
print(L[-1]+L[-2],end="")
else:
print(L[-1]+L[-2])
L.append(L[-1]+L[-2])
``````

Q3.

``````B=int(input())
H=int(input())
for i in range(H):
for j in range(B):
print('*',end="")
if i!=H-1:
print()  ``````

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 2

## NPTEL Programming In Java Week 6 Assignment Answers 2023 