Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Python Math - TypeError: nonetype object is not subscriptable

Asked by Aashna Saito Apr 14, 2021 992 views 1 answer
Share

About this question

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)
The error:
Traceback (most recent call last): File "C:/Users/Nathan/Documents/Python/New thing", line 16, in  
a = lista[1] - lista[0] 
TypeError: 'NoneType' object is not subscriptable

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.