Need help with this week’s assignment? Get detailed and trusted solutions for Python for Data Science Week 1 NPTEL Assignment Answers. Our expert-curated answers help you solve your assignments faster while deepening your conceptual clarity.
✅ Subject: Python for Data Science
📅 Week: 1
🎯 Session: NPTEL 2025 July-October
🔗 Course Link: Click Here
🔍 Reliability: Verified and expert-reviewed answers
📌 Trusted By: 5000+ Students
For complete and in-depth solutions to all weekly assignments, check out 👉 NPTEL Python for Data Science Week 1 NPTEL Assignment Answers
🚀 Stay ahead in your NPTEL journey with fresh, updated solutions every week!
NPTEL Python for Data Science Week 1 Assignment Answers 2025
1. Which of the following variable names are INVALID in Python?
- 1_variable
- variable_1
- variable1
- variable#
Answer : For Answers Click Here
2. Which of the following operators have lower precedence than “not” in Python?
- +
- and
- ==
- |
Answer :
3. What will be the output of the following code?
a = 10
b = 5
p r i n t ( a ∗∗ b % 3 )
- 0
- 100
- 1
- 2
Answer :
4. What will be the output of the following code snippet?
g r e e t i n g s = ”Namaste”
g r e e t i n g s_1 = f l o a t ( g r e e t i n g s )
p r i n t ( type ( g r e e t i n g s_1 ) )
- int
- float
- str
- Code will throw an error.
Answer :
5. Given two variables, j = 6 and g = 3.3. If both normal division and floor division operators were used to divide j by g, what would be the data type of the value obtained from the operations?
- int, int
- float, float
- float, int
- int, float
Answer : For Answers Click Here
6. What will be the output of the following code snippet?
a = ”10”
b = f l o a t ( a ) + 5
r e s u l t = s t r ( b ) + ”123”
p r i n t ( type ( r e s u l t ) )
- <c l a s s ’ f l o a t ’>
- <c l a s s ’ s t r ’>
- <c l a s s ’ i n t ’>
- The code will give an error.
Answer :
7. What will be the output of the following code snippet?
a = 15
b = 3
c = 4
r e s u l t = a + b ∗ c // ( c % b ) − 5
p r i n t ( r e s u l t )
- 20
- 1
- 22
- 0
Answer :
8. What is the output of the following code snippet?
a = 4
b = 5
a ∗= b ∗ 2
p r i n t ( a )
- 10
- 20
- 25
- 40
Answer :
9. What is the output of the following code snippet?
a = 3
b = 5
c = ( a == 3 ) and ( b == 5 ) o r ( a != 3 )
p r i n t ( c )
- True
- False
- Error
Answer :
10. Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?
a = 5
b = 3
p r i n t ( a & b )
- 3
- 7
- 5
- 1
Answer : For Answers Click Here
NPTEL Python for Data Science Week 1 Assignment Answers 2024
Q1. What is the output of the following code?
pythonCopyEditprint(3 * "12")
- a. 36
- b. 121212
- c. 123
- d. Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’
Answer:- b
Explanation: The * operator when used between an integer and a string in Python repeats the string. So 3 * "12" gives "121212".
Q2. What is the output of the following code?
pythonCopyEditprint(-3 // 2)
- a. -1
- b. -2
- c. -1.28
- d. 1.28
Answer:- b
Explanation: The // operator performs floor division. -3 // 2 results in -2 because floor division rounds down to the nearest integer.
Q3. Consider the following code snippet. What is the data type of y?
pythonCopyEditx = 10
y = str(x)
- a. int
- b. float
- c. str
- d. Code will throw an error
Answer:- c
Explanation: str(x) converts the integer value 10 to a string "10", so y becomes a string.
Q4. Which of the following variable names are INVALID in Python?
- a. 1_variable
- b. variable_1
- c. variable1
- d. variable#
Answer:- a d
Explanation: Variable names cannot start with a digit (like 1_variable) and cannot contain special characters like #.
Q5. While naming the variable, use of any special character other than underscore (_) will throw which type of error?
- a. Syntax error
- b. Key error
- c. Value error
- d. Index error
Answer:- a
Explanation: Using unsupported special characters in variable names leads to a syntax error at the time of code interpretation.
Q6. Let x = "Mayur". Which of the following commands converts x to float datatype?
- a. str(float, x)
- b. x.float()
- c. float(x)
- d. Cannot convert a string to float data type
Answer:- d
Explanation: You cannot convert non-numeric strings like "Mayur" to a float. Doing so will raise a ValueError.
Q7. Which Python library is commonly used for data wrangling and manipulation?
- a. Numpy
- b. Pandas
- c. scikit
- d. Math
Answer:- b
Explanation: Pandas is the most popular library for data manipulation and wrangling in Python.
Q8. Predict the output of the following code.
pythonCopyEditprint(int(35/3))
- a. 12.0
- b. 12
- c. 11.667
- d. 11
Answer:- b
Explanation: 35 / 3 results in 11.666..., and int() truncates the decimal part, returning 11.
Q9. Given two variables, j = 6 and g = 3.3, if both normal division and floor division operators were used to divide j by g, what would be the data type of the value obtained from the operations?
- a. int, int
- b. float, float
- c. float, int
- d. int, float
Answer:- b
Explanation: j / g and j // g both return float values when dividing an int by a float.
Q10. Let a = 5 (binary 101) and b = 3 (binary 011). What is the result of the following operation?
pythonCopyEditprint(a & b)
- a. 3
- b. 7
- c. 5
- d. 1
Answer:- d
Explanation: a & b performs bitwise AND. 101 & 011 = 001, which equals 1.


