Python: Division - HackerRank Solution

Python: Division - HackerRank Solution

In this Python HackerRank Division Problem, we have to read two integers a and b from STDIN and perform division.

{tocify} $title={Table of Contents}

HackerRank Python Division Problem

A solution in Python 2 Syntax:

from __future__ import division

# floating point division
print 4 / 3

# integer division  
print 4 // 3

A solution in Python 3 Syntax:

print(4 / 3)
print(4 // 3)

Solution of HackerRank Python Division Problem

# Python: Division - Hacker Rank Solution
from __future__ import division

if __name__ == '__main__':
    a = int(raw_input())
    b = int(raw_input())
    # Python: Division - Hacker Rank Solution START 
    print(a//b);
    print(a/b);
    # Python: Division - Hacker Rank Solution END 

#Solution by Myeduwaves

So this is the solution of HackerRank Python: Division Problem. I hope you understand. If you have any problem then please contact via contacts us page. Now visit this Python HackerRank division problem and try to solve it now.

All the best!

Post a Comment

Previous Post Next Post