NPTEL The Joy of Computing using Python Week 7 Assignment Answers 2024
1. The Chaupar game, also known as Pachisi, involves a player moving their pieces around a cross-shaped board based on the throw of dice (or cowrie shells). The objective is to reach the centre of the board. The steps required to implement the game are given below

✅ Answer :- 213
Explanation: The correct sequence of implementation steps is 2 → 1 → 3 for proper game logic and flow.
2. Given below is a simple algorithm for a Snake and Ladder game. Identify the correct statements regarding variations in the algorithm.
a. A and B
b. Only B
c. A and C
d. Only C
✅ Answer :- c
Explanation: Changing to an octahedral dice (8-faced) affects Step II, and increasing the board to 200 tiles affects both Step I (board setup) and Step III (winning condition).
3. Nishan generates the function is_prime(position)
to check if a player lands on a prime tile. Identify the error line, or -1 if there is no error.

✅ Answer :- 2
Explanation: There’s likely a logical or syntactical error on line 2 in the function definition or prime-checking loop.
4. Find the error in the line of code written using the turtle
library to draw a square. In the absence of an error, enter -1.

✅ Answer :- 7
Explanation: Line 7 likely has a syntax or logic error preventing the square from being drawn properly.
5. Identify the correct statements regarding printing a matrix in a snake pattern. [MSQ]

a. When parity is 0, we print the elements of the row from left to right
b. When parity is 1, we print the elements of the row from left to right
c. When parity is 0, we print the elements of the row from right to left
d. When parity is 1, we print the elements of the row from right to left
✅ Answer :- a, d
Explanation: Even-indexed rows (parity 0) go left to right, odd-indexed rows (parity 1) go right to left for snake pattern.
6. Which of these conditions guarantee that the element is a boundary element of a matrix of order m × n? [MSQ]
a. i == 0
b. i == m-1
c. j == 0
d. j == n-1
✅ Answer :- a, b, c, d
Explanation: Any element in the first or last row/column is a boundary element.
7. Given a set of 4 integers as input, the following code tries to print them in a 2×2 matrix. Identify the error line, or -1 if there’s no error.

✅ Answer :- -1
Explanation: The code correctly converts the 4 integers into a 2×2 matrix, hence no error.
8. How can you write data to a CSV file using the csv
module?
a. write_csv_file()
b. csv.writer()
c. csv.write()
d. write_csv()
✅ Answer :- b
Explanation: csv.writer()
is used to write to a CSV file in Python.
9. Which object is commonly used for reading rows from a CSV file in Python?
a. csv.parser
b. csv.handler
c. csv.reader
d. csv.iterator
✅ Answer :- c
Explanation: csv.reader
reads each row from a CSV file as a list.
10. Identify the correct statement(s) regarding the gmplot
library.
a. I only
b. II only
c. Both I and II
d. Neither I nor II
✅ Answer :- c
Explanation: gmplot
is used to plot data on Google Maps, and gmplot.GoogleMapPlotter(lat, lon, zoom)
is the correct constructor.