zhuhong 发表于 2020-7-30 15:30:04

这个是老python零基础教学第六讲,但是我用的python3.8.5版本的不支持,一直报错。

>>> a < b < c
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
    a < b < c
NameError: name 'a' is not defined
>>> a<b<c
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
    a<b<c
NameError: name 'a' is not defined
>>> (a < b) and (b < c)
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
    (a < b) and (b < c)
NameError: name 'a' is not defined
>>> (a < b) and (b < c)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
    (a < b) and (b < c)
NameError: name 'a' is not defined
>>> (a < b)and(b < c)
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
    (a < b)and(b < c)
NameError: name 'a' is not defined
>>> (a < b)and(b < c)
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
    (a < b)and(b < c)
NameError: name 'a' is not defined

悠悠2264 发表于 2020-7-30 15:31:00

a,b,c都没有定义,当然报错啦

先定义:

a = 1
b = 2
c = 3

zhuhong 发表于 2020-7-30 15:33:21

我擦。我这是.....

zhuhong 发表于 2020-7-30 15:33:52

好,谢谢了

jackz007 发表于 2020-7-30 15:35:02

这么试
a , b , c = 1 , 2 , 3
a < b < c
两行代码分两次输入
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> a , b , c = 1 , 2 , 3
>>> a < b < c
True
>>>

悠悠2264 发表于 2020-7-30 15:36:18

jackz007 发表于 2020-7-30 15:35
这么试
a , b , c = 1 , 2 , 3
a < b < c


嗯嗯,也可以这样写
页: [1]
查看完整版本: 这个是老python零基础教学第六讲,但是我用的python3.8.5版本的不支持,一直报错。