We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Python
  3. Introduction
  4. Arithmetic Operators
  5. Discussions

Arithmetic Operators

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

Sort 721 Discussions, By:

votes

Please Login in order to post a comment

  • aproftr
    5 years ago+ 44 comments
    a = int(input())
    b = int(input())
    
    print('{0} \n{1} \n{2}'.format((a + b), (a - b), (a * b)))
    
    219|
    Permalink
    View more Comments..
  • marinskiy
    4 years ago+ 19 comments

    Here is Python solution from my HackerrankPractice repository:

    a, b = int(input()), int(input())
    print((a + b), (a - b), (a * b), sep='\n')
    

    Feel free to ask if you have any questions :)

    56|
    Permalink
    View more Comments..
  • thetoretto1
    3 years ago+ 1 comment

    Since version 3.6 Python have got f-strings "formatted strings" so it's as easy as this:

    print(f"{a+b}\n{a-b}\n{a*b}")
    
    42|
    Permalink
  • swetasharmakhus1
    3 years ago+ 0 comments

    when a constraint is given so how can set the maximum or minimum limit for the input numbers

    17|
    Permalink
  • apurv_mishra41
    4 years ago+ 4 comments

    if name == 'main':

    what does this line mean? Can anyone please explian?

    10|
    Permalink
    View more Comments..
Load more conversations

Need Help?


View tutorial
View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature