0

I have a small, dumb Python script I created for a course I found that teaches Python for Python 3.4.1. I have Python 2.7.10. I have software on my computer that depends on 2.7.10, and will cause a lot of problems if I upgrade to 3.5. That being said, I need to correct the output I am getting from the following code:

n = int(input("Number? "))
if n<0:
    print('The Absolute value of',n,' is',-n)
else:
    print ('The Absolute value of',n,' is',n)

sumoftwo=50+60
print(sumoftwo)

The output I cannot figure out how to fix is:

For positive integer input:

('The Absolute value of', 123, ' is', 123)
110

For negative integer input:

('The Absolute value of', -5, ' is', 5)
110

I tried a lot of different things like changing from single quotes to double quotes, trying to turn the statement into a string with str(...), and other things I found on different SOF articles, like changing n to {0.n} and `{0.-n}', and nothing gets the output to do the following so far:

The Absolute value of -5 is 5
Debug255
  • 335
  • 3
  • 17

0 Answers0