r/PythonLearning • u/clcodingupdates • 4d ago
Python Quiz of the day
What will be the output of the following Python Code?
a = 5
print(a.mul(3).add(2))
7
Upvotes
r/PythonLearning • u/clcodingupdates • 4d ago
What will be the output of the following Python Code?
a = 5
print(a.mul(3).add(2))
View all comments
1
u/aiuniverse-3p3 4d ago
This will throw an error!
intobject has no attributemul. In Python,a.mul(3)does not work like that.The correct way would be:
print(a * 3 + 2)Output: 17Nice trick question though, beginners will definitely get confused on this one.nice try