Python Forum
Noobie Python TypeError question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Noobie Python TypeError question
#1
Just starting with Python, but have worked with several programming languages over the years. I always prefer explicit typing, but maybe Python will convince me otherwise. I'm taking a course on AI programming and the class is using Python so I am picking it up as the class goes along. I am running into a problem here that I just know is very basic and that I am missing something obvious and most likely stupid. Anyone help me understand why I keep getting this error? Here is the code I have parsed down to the most basic to show the error. The code below was run in IDLE and I can't figure out why it won't print the first item in the list and instead throws this exception. Thanks in advance

>>> x = list['6048922', '334318']
>>> print(x)
list['6048922', '334318']
>>> print(x[0])
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    print(x[0])
TypeError: There are no type variables left in list['6048922', '334318']
Yoriz write Aug-30-2021, 05:23 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Noobie Python TypeError question - by zoid - Aug-30-2021, 05:12 PM
RE: Noobie Python TypeError question - by bowlofred - Aug-30-2021, 05:21 PM
RE: Noobie Python TypeError question - by ibreeden - Aug-30-2021, 05:27 PM
RE: Noobie Python TypeError question - by zoid - Sep-01-2021, 02:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Newbie Question re "TypeError: '<' not supported between instances of 'list' and 'int sr12 8 13,099 Apr-11-2019, 08:19 PM
Last Post: sr12
  Noobie Question, Libreries on Intellij donjon 2 3,076 Dec-16-2017, 01:59 PM
Last Post: Larz60+
  Noobie - IF and Else statement help Jedi 3 3,990 Mar-19-2017, 03:20 AM
Last Post: wavic

Forum Jump:

User Panel Messages

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