Code Fix

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

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

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

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

空欄を埋めて実行を通す

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

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

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

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