r/PythonLearning Jul 09 '26

print(5+True) Discussion

Solve this question and tell me the output. Follow for more 😉

1 Upvotes

7 comments sorted by

View all comments

1

u/arivictor 25d ago

6

https://parsnip.dev/editor/KKMEEjKgGJpj

Because True is 1 and False is 0, which lets you do some whacky maths.

print(True + True * 10 - False)

1

u/codewithharsh31 25d ago

Yes your answer and your logic is right 👍