python 3类型错误:'&燃气轮机';在';int';和';str';在if状态下
这是我正在做的GCSE生物测验。python 3类型错误:'&燃气轮机';在';int';和';str';在if状态下,python,python-3.x,syntax-error,Python,Python 3.x,Syntax Error,这是我正在做的GCSE生物测验。 如果它变成负数,我想把分数设为0 据我所见,变量int\u score表明它包含一个整数,在if语句中,您可以编写: Q_1 = input ('Name the organelles where protiens are synthesised? : ') if Q_1 == 'ribosome': print ('correct') score = score + 1 else: print ('WRONG') Q_2 = inpu
如果它变成负数,我想把分数设为0 据我所见,变量
int\u score
表明它包含一个整数,在if语句中,您可以编写:
Q_1 = input ('Name the organelles where protiens are synthesised? : ')
if Q_1 == 'ribosome':
print ('correct')
score = score + 1
else:
print ('WRONG')
Q_2 = input ('Suggest why plant cells have a cell wall and animal cells don\'t ?: ')
if Q_2 == 'To control the flow of water and oxygen':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_3 = input ('True or false is bacteria an examples of a prokaryotic cell ?: ')
if Q_3 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_4 = input ('True or false prokaryotes don\'t have a cell wall ?: ')
if Q_4 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_5= input ('What is a stem cell?: ')
if Q_5 == 'An undifined cell':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_6 = input ('True or false there are embryonic stem cells?: ')
if Q_6 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_7 = input ('What is diffusion?: ')
if Q_7 == 'The movment of gas particles from an area of high concentraction to low concentration':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_8 = input ('True or false having a greater surface area increase the rate of diffusion?: ')
if Q_8 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_9 = input ('Define osmosis ?: ')
if Q_9 == 'The movment of water particles from an area of high to low concentration':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_10 = input ('True or false increasing temperature increases the rate of osmosis?: ')
if Q_10 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
int_score = int(score)
if int_score >'0':
score = 0
print (score)
作为旁注,我建议您检查正确答案的算法不是最优的,因为您必须输入准确的答案才能获得正确答案。您可能需要检查以下关键字:
假设答案是光合作用产生葡萄糖和氧气,检查“葡萄糖”和“氧气”:
if int_score < 0:
...
从我所看到的,变量
int\u score
表明它包含一个整数,在if语句中,您编写:
Q_1 = input ('Name the organelles where protiens are synthesised? : ')
if Q_1 == 'ribosome':
print ('correct')
score = score + 1
else:
print ('WRONG')
Q_2 = input ('Suggest why plant cells have a cell wall and animal cells don\'t ?: ')
if Q_2 == 'To control the flow of water and oxygen':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_3 = input ('True or false is bacteria an examples of a prokaryotic cell ?: ')
if Q_3 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_4 = input ('True or false prokaryotes don\'t have a cell wall ?: ')
if Q_4 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_5= input ('What is a stem cell?: ')
if Q_5 == 'An undifined cell':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_6 = input ('True or false there are embryonic stem cells?: ')
if Q_6 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_7 = input ('What is diffusion?: ')
if Q_7 == 'The movment of gas particles from an area of high concentraction to low concentration':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_8 = input ('True or false having a greater surface area increase the rate of diffusion?: ')
if Q_8 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_9 = input ('Define osmosis ?: ')
if Q_9 == 'The movment of water particles from an area of high to low concentration':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
Q_10 = input ('True or false increasing temperature increases the rate of osmosis?: ')
if Q_10 == 'true':
print ('correct')
score = score + 1
else:
print ('WRONG')
score = score -1
int_score = int(score)
if int_score >'0':
score = 0
print (score)
作为旁注,我建议您检查正确答案的算法不是最优的,因为您必须输入准确的答案才能获得正确答案。您可能需要检查以下关键字:
假设答案是光合作用产生葡萄糖和氧气,检查“葡萄糖”和“氧气”:
if int_score < 0:
...