Python Forum
Newbie Question re "TypeError: '<' not supported between instances of 'list' and 'int
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie Question re "TypeError: '<' not supported between instances of 'list' and 'int
#1
def function_1(x):
    if x < 0:
        return -1000000000
    else:
        return (x ** (1-2)-1)/(1-2)

list = [1, 2, 3, 4,]

[function_1(i) for i in list] 
so I have a function (with a condition as above) -- the intent is to apply that function to each number in a list (and get a new list with the result). Getting stuck here with error: "TypeError: '<' not supported between instances of 'list' and 'int'"

all help appreciated
Reply


Messages In This Thread
Newbie Question re "TypeError: '<' not supported between instances of 'list' and 'int - by sr12 - Apr-11-2019, 07:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How is pandas modifying all rows in an assignment - python-newbie question markm74 1 767 Nov-28-2023, 10:36 PM
Last Post: deanhystad
  newbie question - can't make code work tronic72 2 751 Oct-22-2023, 09:08 PM
Last Post: tronic72
  Newbie question about switching between files - Python/Pycharm Busby222 3 679 Oct-15-2023, 03:16 PM
Last Post: deanhystad
  Newbie.... run for cover. OpenCV question Stevolution2023 2 1,033 Apr-12-2023, 12:57 PM
Last Post: Stevolution2023
  numpy newbie question bcwilly_ca 4 1,247 Feb-10-2023, 05:55 PM
Last Post: jefsummers
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,997 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  TypeError: unsupported opperand type(s) for %: 'int' and 'list' cool_person 7 2,288 May-07-2022, 08:40 AM
Last Post: ibreeden
  TypeError: list indices must be integers or slices, not range Anldra12 2 2,733 Apr-22-2022, 10:56 AM
Last Post: Anldra12
  Noobie Python TypeError question zoid 4 8,022 Sep-01-2021, 02:28 PM
Last Post: zoid
  Question from complete python's newbie Davicom 3 2,454 Jun-09-2021, 06:09 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020