The Joy of Computing Using Python Week 3 assignment answers ? In this article we will discuss about the answers of week 3 of joy of computing. The answers shared here will be based on our own knowledge. Please use this as your reference. Â
About NPTELÂ
The Joy Of Computing Using Python Week 3 Assignment 2023Â
Q1. ___________Â is the method to insert an item into a specified position in a list.Â
a. PushÂ
b. WriteÂ
c. Insert
d. All the aboveÂ
Answer: [ c ] InsertÂ
Q2. Which method returns the number of occurences of an element in a list.Â
a. Number ofÂ
b. TotalÂ
c. CountÂ
d. LengthÂ
Answer: [ c ]Â CountÂ
Q3. The function random.randint(1,100) in python generates.Â
a. A random integer between 1 to 100 with 1 and 100 both inclusive.
b. A random integer between 1 to 100 with 1 and 100 both exclusive.
c.  A random integer between 1 to 100 with only 100 inclusive.
d. All the aboveÂ
Answer: [ d ] All the aboveÂ
Q4. The method open ("file.txt" , r+ ) opens the file file1.txt in ________
a. Read only modeÂ
b. Write only mode Â
c. Read Write ModeÂ
d. None of the aboveÂ
Answer: [ c ] Read Write Mode
Q5. Consider the list L = { 0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 } . What is the output of this code forÂ
    the statement L [ 3:6]Â
a. [ 2,3,5 ]Â
b. [ 0,1,1 ]
c. [ 1,2,3 ]
d. noneÂ
Answer: [ a ]Â [ 2, 3, 5 ]Â
 Q6. What is the output of this code ?Â
      a, b = 1, 0 Â
      a = a^b
      b = a^bÂ
      a = a^bÂ
      print ( a )Â
a. 0Â
b. 1
c. 2Â
d. The code will raise a runtime errorÂ
Answer: [ a ]Â Â 0Â Â
Q7. What is the output of this code ?Â
    def foo (l):Â
       a = l [ 0 ]Â
       for i in l :Â
          if i < a :Â
            a = iÂ
       return aÂ
    print ( foo ( [ 2 , 3 , 5 , 1 , 6 ] ) ) Â
Answer:Â 1Â
Q8. What is the output of this code ?Â
    def bar ( string ):Â
       left = 0Â
       right = len (string )Â
       while ( left < right )Â
            if ( String [ left ] != string [right ] )Â
                  return falseÂ
            left += 1Â
            right -= 1Â
        return TrueÂ
    print ( bar ("telugu") )
    print ( bar (" Malayalam " ) )Â
a. False TrueÂ
b. True FalseÂ
c. True TrueÂ
d. False FalseÂ
Answer:Â [ a ]Â Fasle TrueÂ
Q9. Explain what will be the output of the following code when given below is executed?Â
a. The program throws an errorÂ
b. 5Â
c. 5.5Â
d. 4.5Â
Answer: [ d ]Â 4.5Â
Q10. Which among the following statements is True with respect the following code given belowÂ
       Count = 0Â
       for i in range (10) :Â
         for j in range ( 5):Â
            Count + = i*jÂ
       print (count )Â
a. count = 50Â
b. The following code throws up an errorÂ
c. count = 550Â
d. count = 450Â
Answer: [ d ] 450Â
Â
Programming Assignment Â
 N = int(input()) for i in range(1,N+1):    for j in range(1,i+1):       print('* ',end="")    print(){codeBox}
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]){codeBox}
B=int(input())H=int(input())for i in range(H):Â for j in range(B):Â Â print('*',end="")Â if i!=H-1:Â ÂÂ Â print() {codeBox}
Conclusion:Â
Finally, these are the answers for Week 3 Assignment. Please recheck on 15 Feb for any Re-correction of answers.Â