Nptel The Joy of Computing Using Python Week 2 Assignment Answers
Searching for the Week 2 answers of the Nptel The Joy of Computing Using Python course? You’re in the right spot! Here, you’ll find reliable and up-to-date solutions to help you complete your Week 2 assignment with confidence.

The Joy of Computing using Python
ABOUT THE COURSE :
INTENDED AUDIENCE : Any interested audience
PREREQUISITES : 10th standard/high school
INDUSTRY SUPPORT : Every software company is aware of the potential of a first course in computer science. Especially of a first course in computing, done right.
COURSE LAYOUT – Click To Know More
- Motivation for Computing
- Welcome to Programming!!
- Variables and Expressions : Design your own calculator
- Loops and Conditionals : Hopscotch once again
- Lists, Tuples and Conditionals : Lets go on a trip
- Abstraction Everywhere : Apps in your phone
- Counting Candies : Crowd to the rescue
- Birthday Paradox : Find your twin
- Google Translate : Speak in any Language
- Currency Converter : Count your foreign trip expenses
- Monte Hall : 3 doors and a twist
- Sorting : Arrange the books
- Searching : Find in seconds
- Substitution Cipher : What’s the secret !!
- Sentiment Analysis : Analyse your Facebook data
- 20 questions game : I can read your mind
- Permutations : Jumbled Words
- Spot the similarities : Dobble game
- Count the words : Hundreds, Thousands or Millions.
- Rock, Paper and Scissor : Cheating not allowed !!
- Lie detector : No lies, only TRUTH
- Calculation of the Area : Don’t measure.
- Six degrees of separation : Meet your favourites
- Image Processing : Fun with images
- Tic tac toe : Let’s play
- Snakes and Ladders : Down the memory lane.
- Recursion : Tower of Hanoi
- Page Rank : How Google Works !!
Nptel The Joy of Computing Using Python Week 2 Assignment Answers
- Statement: If a variable is assigned a value once, the value in the variable cannot be changed in the variable.
a. False, the variable stores all values it was assigned.
b. False, the variable stores the value from the latest assignment.
c. True, the variable stores only the value from the second-last assignment.
d. True, the variable stores value from the initial assignment only.
View Answer
- Which of the following code blocks prints – “Ramesh talks to Suresh and Kamlesh”?
a.print(j'Ramesh talks to Suresh and Kamlesh" + and")
b.print("Ramesh talks to " "Suresh" " Kamlesh")
c.print("Ramesh talks to Suresh" " and " " Kamlesh ")
d.print("Ramesh talks to" "Suresh and Kamlesh")
View Answer
- What aren’t the correct ways to inform Python that input is a decimal point number?
a.in(input())
b.float(input())
c.int(input())
d.
a = input()
a = int(a)
View Answer
- The following program outputs 723.
def mystery(container):
result = []
for i in range(len(container)):
result.append(i)
else:
result.append(len(container))
return result
For what value of a
does the code output 123?
a. 1
b. 2
c. 6
d. 5
View Answer
For Latest Update Join our official channel: Click here to join
- What does the previous question calculate?
a. Calculates the factorial ofa
.
b. Calculates the factorial ofa-1
and adds 3.
c. Calculates the factorial ofa-1+3
.
d. Calculatesa
multiples ofa
starting from 1 and adds 3.
View Answer
- Which loop is used to perform a set of repetitive tasks without a condition by default in Python?
a. while loop
b. for loop
c. do-while loop
d. while-range loop
View Answer
- What happens when the condition inside the
if
andwhile
evaluate to false?
a. Python interpreter ignores theif
/while
blocks and halts the program.
b. Python interpreter ignores theif
/while
blocks and proceeds with the program from the lines after theif
/while
block.
c. Python interpreter executes theif
/while
blocks and the rest of the program.
d. Python interpreter executes theif
/while
blocks, and the program runs in an infinite loop.
View Answer
- The following program might/might not have an infinite loop. Does the program have an infinite loop?
while True:
a.append(n % 10)
a.sort()
for i in a:
if (b < k):
print("FUN")
else:
print("IS BORING")
a. No, the program doesn’t have an infinite loop.
b. Yes, it can be prevented by updating the value of a
before the if
block at line 3.
c. Yes, it can be prevented by removing both the if
blocks inside the while loop.
d. Yes, but it cannot be prevented.
View Answer
For Latest Update Join our official channel: Click here to join
- For which of the following values of
name
andage
variables does the following code print ‘You are lucky’?
name = input("Enter your name: ")
age = int(input("Enter your age: "))
flag = False
if age > 18:
flag = True
counter = 0
for i in name:
counter += 1
if flag and (counter % 2 == 0):
print("You are lucky")
else:
print("You are not lucky")
a. aryan, 20
b. arjun, 19
c. aakash, 16
d. anand, 18
View Answer
- For which of the options from the previous question does the program not print anything?
a. aryan, 20
b. aakash, 16
c. arjun, 19
d. anand, 18
View Answer
Nptel The Joy Of Computing Using Python Week 3 Assignment Answers – Click Here