Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+6 votes

What is the difference between / and //?

I know both produce float numbers

asked in CSC201 Spring 2021 by (1 point)

5 Answers

+2 votes

/ will produce floating division
Ex: 27/8 = 3.375
// will produce integer division
Ex: 27/8 = 3

Hope this helps!

answered by (1 point)
0

ahh!! thank you~!!!!

+2 votes

/ is used for regular division, and produces float numbers.

// is used for integer division, and only produces integers, dropping any remainder.

for example, 9//2 = 4 , since 2 goes into 9 4 whole times.

answered by (1 point)
0

thanks so much!!!

+2 votes

/ is for regular division and // is used to indicate integer division. 10/3=3.33 but 10//3=3 because 3 goes into 10 three times.

answered by (1 point)
+2 votes

You use / when you want division that answer only keeps the whole integer and drop the remainder

You use / when you want division that answer will be a float, which comes out to be a decimal number, ...

answered by (1 point)
+1 vote

/ is used as a regular division and it produces floating numbers. For example- 22/3 = 7.33

// is used as a integer division and produces integers and real numbers, leaving out the remainders.
For example- 24/5 = 4 (5*4=20)

answered by (1 point)
...