Python: Division

I received an email message from HackerRank suggesting a Python challenge. The challenge is described in the following URL:  https://www.hackerrank.com/challenges/python-division?utm_campaign=challenge-recommendation&utm_medium=email&utm_source=24-hour-campaign

Following is the output from a console using Visual Studio 2013 Professional with the PTVS (Python Tools for Visual Studio) plug-in using the sample input data:

4 <== input data

3 <== input data

1

1.3333333333333333

Press any key to continue . . .

The actual code is short and simple (you could call it trivial):

if __name__ == ‘__main__’:

# **** read input ****

a = int(input())

b = int(input())

# **** divide and print ****

print(a // b)

print(float(a) / float(b))

The solution passed the 2 test cases.

If you have comments or questions regarding this or any other post in this blog please do not hesitate and send me an email message. I will reply as soon as possible not making use of your name unless you explicitly tell me to do so.

John

john.canessa@gmail.com

Follow me on Twitter: @john_canessa

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.