首页 > 解决方案 > 我正在尝试使用 notepad++ 启动一个简单的计算器程序,我做错了什么?

问题描述

我对编程和编码很陌生,但我正在努力学习。我正在尝试在 Notepad++ 上编写一个简单的计算器,但我收到:'notepad++' 不被识别为内部或外部命令、可运行程序或批处理文件。这是代码

# Python code to demonstrate the working of  
# logical_and(), logical_or(), logical_xor() 
# and logical_invert() 

# importing "decimal" module to use decimal functions 
import decimal 

# Initializing decimal number 
a = decimal.Decimal(1000) 

# Initializing decimal number 
b = decimal.Decimal(1110) 

# printing logical_and of two numbers 
print ("The logical_and() of two numbers is : ",end="") 
print (a.logical_and(b)) 

# printing logical_or of two numbers 
print ("The logical_or() of two numbers is : ",end="") 
print (a.logical_or(b)) 

# printing exclusive or of two numbers 
print ("The exclusive or of two numbers is : ",end="") 
print (a.logical_xor(b)) 

# printing logical inversion of number 
print ("The logical inversion of number is : ",end="") 
print (a.logical_invert()) ` 

我究竟做错了什么?我正在尝试通过命令提示符运行,也许这就是问题所在?

标签: python

解决方案


Notepad++ 不能用作 python 的交互式终端。在终端中执行脚本时,您应该使用 input() 接收输入。


推荐阅读