Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Insert, vary basic issue
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
RyGuy-Anime




PostPosted: Sun Feb 05, 2012 2:18 pm   Post subject: Insert, vary basic issue

i am just learning python and am unable to grasp the error in my programming because i literally just started learning, i tried to manipulate a list in python 3 and i am getting an attribute error on the insert command :/ please help


Untitled.png
 Description:
this is the problem i had in IDLE
 Filesize:  7.17 KB
 Viewed:  11329 Time(s)

Untitled.png


Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sun Feb 05, 2012 2:33 pm   Post subject: RE:Insert, vary basic issue

A list is in square brackets. Round brackets denote a tuple (I assume).

Try comp = ["ryan, 1, "zaid", 2, "peter", 3]
RyGuy-Anime




PostPosted: Sun Feb 05, 2012 2:35 pm   Post subject: Re: Insert, vary basic issue

YOU SIR are a life saver Very Happy!!!!
Velocity




PostPosted: Fri Feb 10, 2012 3:58 pm   Post subject: RE:Insert, vary basic issue

lol you never tryed to solve it? didnt you read the turing post assist? "What have you done to try and solve this problem"? ? Insectoid, thanks alot for helping him.
[Gandalf]




PostPosted: Fri Feb 10, 2012 8:24 pm   Post subject: RE:Insert, vary basic issue

Velocity, stop. Really, stop. This is the Python forum, there is no Turing Help post template...

RyGuy-Anime: The main difference between tuples and lists is that tuples are immutable (they can't be modified after being initialized) while lists are mutable (you can add and remove elements freely). That's also why your immutable tuple doesn't have a method to insert.
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: