About a back slash caliculation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

About a back slash caliculation

(5//1.5) what will be the output and how

1st Feb 2022, 1:32 AM
vivek vikky
4 Answers
+ 2
Okay, actually they are double forward slashes. So the output of(5//1.5) is going to be 3.0. Why? This is my method: Change 1.5 to 15 to make it easy for you. Then ask yourself how many times will 5 multiply 15. It's three times,right? Because it included a float which is 1.5 in this case, your answer must be in a float. So you just add a .0 to the 3 to get 3.0 as your answer.
1st Feb 2022, 1:49 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
+ 2
282 / 5,000 Resultados de traducción import math print((5/1.5))#3.3333333333333335 print((5//1.5))#3.0 print(float(math.floor((5/1.5))))#3.0 print((5//2))#2 print(math.floor((5/2)))#2 it is the same as doing a floor which returns the integer without decimals obviously if you divide for a float you will get a float
1st Feb 2022, 1:50 AM
L.M.Paredes
L.M.Paredes - avatar
+ 1
That is my easy method. My method is to get rid of the decimal first to prevent confusion then I introduce the decimal after I get my answer. And it works.
1st Feb 2022, 1:53 AM
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘
Hafsa Ahmed(small GENUIS)💯🇬🇭🤘 - avatar
0
What ever value it is we need to remove float and calculate the value right?
1st Feb 2022, 1:51 AM
vivek vikky