我没有错误,但是也没有输出?
有人可以告诉我我在做什么错吗?
我认为问题是事实的数目,可能是我做错了什么?
class weather():
numberOfFacts = 0
count = 0
facts = ''
def __init__(self, FACTS, addFACTS, countFACTS, printFACTS, infer):
self.FACTS == FACTS
self.addFACTS == addFACTS
self.countFACTS == countFACTS
self.printFACTS == printFACTS
self.infer == infer
FACTS.sunIsShining = False;
FACTS.weatherIsHot = False;
FACTS.weatherIsCold = False;
FACTS.wearSunGlasses = False;
FACTS.summerTime = False;
FACTS.winterTime = False;
FACTS.darkClouds = False;
FACTS.itsRaining = False;
FACTS.openUmbrella = False;
FACTS.wearCoat = False;
for fact in f:
if (FACTS([fact])) ++ 1:
return count
for fact in f:
print("<p>" + fact + "is" + FACT[facts] + "<p>")
numberOfFacts == countFACTS
if FACTS.winterTime and FACTS.wearCoat == True: print(FACTS.wearCoat == False)
if FACTS.weatherIsCold and FACTS.winterTime == True: print(FACTS.summerTime == True)
if FACTS.itsRaining and FACTS.darkCloud == True: print(FACTS.sunIsShining == False)
if (FACTS.sunIsShining & FACTS.summerTime) and FACTS.wearSunGlasses == True: print(FACTS.wearSunGlasses == False)
if FACTS.itsRaining and FACTS.openUmbrella == True: print(FACTS.openUmbrella == False)
if (FACTS.sunIsShining & FACTS.winterTime) == True: print(FACTS.wearSunGlasses == False, FACTS.darkClouds == False)
if FACTS.summerTime and FACTS.weatherIsHot == True: print(FACTS.weatherIsHot == False)
return
答案 0 :(得分:0)
T VonB。=是赋值运算符(您要使用的那个)。您正在使用==,相等比较。您不是在 init ()函数的开头分配值,而是在比较它们。
编辑:(1)为什么在Python中使用分号
(2)您从未在for循环中定义“ f”。
(3)您要在 init
中返回None以外的内容