小编Nat*_*ott的帖子

Python Math - TypeError:'NoneType'对象不可订阅

我正在为数学创建一个小程序(没有特别的原因,只是想要)并且我遇到了错误"TypeError:'NoneType'对象不可订阅.

我以前从未见过这个错误,所以我不知道这意味着什么.

import math

print("The format you should consider:")
print str("value 1a")+str(" + ")+str("value 2")+str(" = ")+str("value 3a ")+str("value 4")+str("\n")

print("Do not include the letters in the input, it automatically adds them")

v1 = input("Value 1: ")
v2 = input("Value 2: ")
v3 = input("Value 3: ")
v4 = input("Value 4: ")

lista = [v1, v3]
lista = list.sort(lista)

a = lista[1] - lista[0]

list = [v2, v4]
list = list.sort(list)

b = list[1] = list[0]

print str(a)+str("a")+str(" = ")+str(b) …
Run Code Online (Sandbox Code Playgroud)

python sorting math in-place

49
推荐指数
2
解决办法
26万
查看次数

标签 统计

in-place ×1

math ×1

python ×1

sorting ×1