'none' prints for no apparent reason

Viewed 48
print("Entre nummber 1: ")
num1 = float(input('> '))
print("Entre opperation: ")
op = input('> ')
print("Entre nummber 2: ")
num2 = float(input('> '))
result = print("Your Result is:")

if op == "+":
    print(num1 + num2)
    print(result)
    print("Done")

elif op == '-':
    print(num1 - num2)
    print(result)
    print("Done")

elif op == '/':
    print(num1 / num2)
    print(result)
    print("Done")

elif op == '*':
    print(num1 * num2)
    print(result)
    print("Done")
elif op == '**':
    print(num1 ** num2)
    print(result)
    print("Done")
else:
    print("Entre a valid opperation")

I tried to make a calculator. It works fine but when at the end a 'none' pops up for no apparent reason .

I don't know why. Any help is appreciated.

This is the problem: enter image description here

3 Answers
result = print("Your Result is:")

print("Your Result is:") prints this string "Your Result is:" and returns None and now result is equal None. then print(result) prints None

result = print("Your Result is:")

print return nothing None

value of result is None

print(result) #this is none

You should store it in a variable like

result = num1 + num2
print(result) #with calculated value
# remove result = print("Your result is :")
# Add this result = num1 'operation +/-/*/** etc' num2 after your if condittions.
# for example :
if op == "+":
    result = num1 + num2
    print("Your result is :",result)
if op == "-" :
    result = num1 - num2
    print("Your result is :",result)
# It will work fine. 
Related