【发布时间】:2021-11-23 06:54:36
【问题描述】:
这是我的 python 代码:我最后得到的唯一输出是 "True" 为什么我没有收到其他人的输出?请帮忙。 我在 Visual Studio 代码上使用 jupyter notebook。内核:Python 3.9 64 位
# RELATIONAL OPERATORS
num1 = 10
num2 = 0
num3 = 10
str1 = "good"
str2 = "life"
# Equals to
num1 == num2
str1 == str2
# Not equal to
num1 != num2
str1 != str2
num1 != num3
# Greater Than
num1 > num2
str1 > str2
# Less Than
num1 < num3
str2 < str1
# Greater than or equal to
num1 >= num2
num2 >= num3
str1 >= str2
#Less then or equal to
num1 <= num2
num2 <= num3
str1 <= str2
【问题讨论】:
-
你没有用print,把这些表达式写在
print() -
对于极端的初学者来说,这可能值得注意,这取决于源代码的来源/您阅读的教程,will show output in the REPL for every statement 因为那是 REPL 所做的。 REPL 以
>>>开头。在一个完整的程序中,你需要告诉 Python 向你展示输出。 -
啊,是的,它成功了!谢谢!
标签: python visual-studio-code jupyter-notebook relational-operators