Web Analytics Made Easy -
StatCounter Beginner Python Question. What's wrong with my code ? - CodingForum

Announcement

Collapse
No announcement yet.

Beginner Python Question. What's wrong with my code ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Beginner Python Question. What's wrong with my code ?

    Code:
    num1 = input ('enter First Number')
    num2 = input('enter second number')
    operator = input('Enter operator')
    num1 = int(num1)
    num2 = int(num2)
    
    if operator == "+":
      print("{} + {} = {}" .format(num1, num2, num1+num2))
    
    elif operator == "-":
      print("{} - {} = {}".format(num1, num2,  num1 - num2))
    
    elif operator == "*":
      print("{} * {} = {}".format(num1, num2, num1 * num2))
    
    elif operator == "/" :
      print("{} / {} = {}".format(num1, num2, num1 / num2))
    
    else:
      print("Use either + - * or /")



    output in the picture
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	3.9 KB
ID:	2284176
    Last edited by vinyl-junkie; Jul 8, 2017, 09:44 AM. Reason: added code tags

  • #2
    It is just additional information provided by the IDE's console. The real program output is the following :

    enter First Number 5
    enter second number 5
    Enter operator -
    5 - 5 = 0
    It Says that the Process finished with exit code 0 means that everything worked ok.
    You are not supposed to run your Python programs from the IDE when in production so I think trying to remove that is irrelevant.
    ASP.Net Software Development

    Comment

    Working...
    X