Sivakumar Vijayan
PRO
last month
Sivakumarcountry asked

Why there are two // Slash for the division

N
Expert
last month
Nisha Sharma answered

Hello there, nice question!

The double slash // is used in Python for integer division. Unlike the single slash /, which returns a decimal value, // divides the numbers and gives the result as a whole number. Since the formula for the sum of natural numbers always results in an integer, using // helps keep the output clean and avoids unnecessary decimal points.

Feel free to reach out if you have any more queries.

Python
This question was asked as part of the DSA with Python course.