Python: Division Hacker Rank Solution – Queslers

Problem: Python: Division Hacker Rank Solution

Task

The provided code stub read two integers, a and b, from STDIN.

Add logic to print two lines. The first line should contain the result of integer division, a // b. The second line should contain the result of float division, a / b.

No rounding or formatting is necessary.

Example

a = 3

b = 5

  • The result of the integer division 3 // 5 = 0.
  • The result of the float division 3 / 5 = 0.6. 
0
0.6

Input Format

The first line contains the first integer, a.

The second line contains the second integer, b.

Output Format

Print the two lines as described above.

Sample Input 0

4
3

Sample Output 0

1
1.33333333333

Python: Division Hacker Rank Solution Using Python 2

a = int(raw_input())
b = int(raw_input())
print a/b
print a/float(b)

Python: Division Hacker Rank Solution Using Python 3

if __name__ == '__main__':
    a = int(input())
    b = int(input())
    print(a//b)
    print(a/b)

Python: Division Hacker Rank Solution Using Pypy

import sys
alls = []
for line in sys.stdin:
	alls.append(int(line.strip()))
print alls[0]/alls[1]
print float(alls[0])/float(alls[1])

Python: Division Hacker Rank Solution pypy3

# Enter your code here. Read input from STDIN. Print output to STDOUT
num = int(input())
den = int(input())

print(num//den)
print(num/den)
Python: Division Hacker Rank Solution Review:

In our experience, we suggest you solve this Python: Division Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

Python: Division Hacker Rank Problem is available on Hacker Rank for Free, if you are stuck anywhere between a compilation, just visit Queslers to get Python: Division Hacker Rank Solution.

Conclusion:

I hope this Python: Division Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Hacker Rank Problem & Solutions >>

Staircase Hacker Rank Solution

A Very Big Sum Hacker Rank Solution

Diagonal Difference Hacker Rank Solution

Nested Lists Hacker Rank Solution

Lists Hacker Rank Solution

Leave a Reply

Your email address will not be published.