age=('17')
if age<18:
print('teenager')
else:
print('adult')
你的17定义的是字符串......把引号去了就行
age=('17')你这样给是字符串,正常会产生错误,如下not supported between instances of 'str' and 'int',
改成age =17即可
Computer regarded your
『('17')』 of 『age=('17')』 as a 'string',not a 'number'.
So it's working like down here
else:
print('adult')
If you change your code from
____________________________________
age=('17') <-----------------------
if age<18:
print('teenager')
else:
print('adult')
____________________________________
to
____________________________________
age=17
<------------------------
if age<18:
print('teenager')
else:
print('adult')
____________________________________
That will be correct.
Enjoy your coding.(^_^)