题目是这样的,两个list a和ba和b的length都要是5a==ba不是ba[0] 是 b[0]a[1] 不是 b[1]a[2[ 是 b[2]a[3] 不是 b[3]a[4] 是 b[4]
2 回答
郎朗坤
TA贡献1921条经验 获得超9个赞
class
NewList(
list
):
def
__eq__(
self
,obj ):
for
i
in
range
(
0
,
5
,
2
):
if
self
[ i ] !
=
obj[ i ]:
return
False
return
True
a
=
NewList(
range
(
5
) )
b
=
NewList(
range
(
5
) )
b[
1
]
=
b[
3
]
=
'123123'
print
( a
=
=
b )
梦里花落0921
TA贡献1772条经验 获得超6个赞
a
=
int
(
input
(
'Please input the first number:'
))
b
=
int
(
input
(
'Please input the second number:'
))
def
func(a, b):
if
a > b:
print
(
'{0} A={1} B={2}'
.
format
(
"A>B"
, a, b))
elif
a < b:
print
(
print
(
'{0} A={1} B={2}'
.
format
(
"A<B"
, a, b)))
else
:
print
(
print
(
'{0} A={1} B={2}'
.
format
(
"A==B"
, a, b)))
func(a, b)
添加回答
举报
0/150
提交
取消