1-9 Python判断结构
判断结构¶
In [3]:
tang=100
if tang>200:
print('OK')
print('test')##有缩进就不在就不在if条件结构中
In [6]:
tang=100
if tang >200:
print('200')
elif tang<100:
print('100')
else:
print('100-200')
In [7]:
tang=50
if tang>200:
print('200')
elif tang<100:
print('100')
else:
print('100-200')
In [8]:
tang=[123,456,789]
if 123 in tang:
print('OK')
In [9]:
tang={'tang':123,'yudi':456}
if 'tang'in tang:
print('ok')
此资源来自https://www.cnblogs.com/AI-robort/,博客园的karina512。