6. What will be the output of the following ?
print (len(str(17//4)) )
print (len(str(17/4)) )
Answers
Answered by
0
Answer:
$ python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fractions
>>> print(len(str(fractions.Fraction(17,14))))
5
>>> print(str(fractions.Fraction(17,14)))
17/14
>>> print(type(fractions.Fraction(17,14)))
<class 'fractions.Fraction'>
>>> print(type(17/14))
<class 'float'>
>>> print(str(17/14))
1.2142857142857142
>>> print(len(str(17/14)))
18
>>>
Explanation:
Similar questions