Code Fix

初級TypeError: '>' not supported between instances の原因と直し方 › パターン1

TypeError: '>' not supported between instances の原因と直し方

文字列と数値、あるいはNoneと数値など、比較できない型同士を比較しようとしたときに出るエラーです。

 1  age = ____
            ^
 2  if age > 18:
 3      print("adult")
Traceback (most recent call last): File "main.py", line 2, in <module> if age > 18: ^^^^^^^^ TypeError: '>' not supported between instances of 'str' and 'int'

空欄を埋めて実行を通す

広告
広告スロット(未設定)

TypeError: '>' not supported between instances の原因と直し方

このエラーの解説と類題をまとめて見る →

広告
広告スロット(未設定)