[我试图做一个简单的计算器,但工作正常,但完成后我什么也没得到]]

问题描述 投票:2回答:3
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")

我试图制作一个计算器,但可以正常工作,但最后无故弹出“ none”我不知道为什么要感谢您的帮助

This is the probleme

print(“ Entre nummber 1:”)num1 = float(input('>'))print(“ Entre opperation:”)op = input('>')print(“ Entre nummber 2:”)num2 = float (input('>'))result = print(“您的结果是:”)如果op ...

python python-3.7
3个回答
2
投票
result = print("Your Result is:")

4
投票
result = print("Your Result is:")

0
投票
# 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. 
© www.soinside.com 2019 - 2024. All rights reserved.