python - 我正在尝试使用 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()) `
我究竟做错了什么?我正在尝试通过命令提示符运行,也许这就是问题所在?
解决方案
Notepad++ 不能用作 python 的交互式终端。在终端中执行脚本时,您应该使用 input() 接收输入。
推荐阅读
- php - Codeigniter 4 没有在带有下划线的子目录中找到带有连字符的 url 的默认控制器
- android - Camera2:设置光学稳定功能无济于事 (OIS)
- javascript - 如何修复移动版本的范围滑块?
- http - Discord.js HTTP 请求
- gnupg - 即使使用 gpg-preset-passphrase 设置了密码,gpg 也会提示输入密码
- linux - 为什么 /dev/urandom 不阻塞?
- google-sheets - Google Sheets - add all values until last key is found
- mysql - 无法启动mysql服务,强制恢复不起作用
- python - 使用 Turtle 绘制一系列形状,但只显示一个
- python - 用 Python 处理文档