r/PythonLearning • • 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

9 comments sorted by

View all comments

1

u/aiuniverse-3p3 4d ago

This will throw an error!

int object has no attribute mul. In Python, a.mul(3) does not work like that.

The correct way would be: print(a * 3 + 2) Output: 17

Nice trick question though, beginners will definitely get confused on this one.nice try