pls help. beginner question.

+1 Marco Alexis · August 17, 2015
I'm just starting to watch the tutorials and after every episode I tried each topic, but when I came in lists topic, it gives me error

>>> players[:3] = []
Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    players[:3] = []
TypeError: 'tuple' object does not support item assignment

>>> players.append[11]
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    players.append[11]
AttributeError: 'tuple' object has no attribute 'append'

What have I done wrong?

Post a Reply

Replies

- page 1
Oldest  Newest  Rating
0 chikki bhargava · September 12, 2015
you were using wrong box (), i guess like players.append( ) this is right format
0 Marco Alexis · August 21, 2015
Thanks mate. I've also read from online courses the value of indentation in code blocks. :)
0 Halcyon Abraham Ramirez · August 21, 2015
In your 1st example your print statement was inside the for loop. Hence it printed start everytime it was incremented. on the second example you pronted start after the for loop thats why you only had one result 
0 Marco Alexis · August 21, 2015
ahaha! bisaya jud d ay. wala bai. mechanical ko. gusto lang ko makat.on programming para hobby bah. hehe
unsa imong trabaho dha bai?
0 Marco Alexis · August 21, 2015
How did the indention vary the results?Can someone explain the difference please. :)
This;
def unli_numbers(*args):
start = 0
for a in args:
start += a
print(start)


unli_numbers(4, 6, 40, 50, 34, 566, 345, 678, 4, 567, 43, 55, 45, 88, 89)


2614

From this;
def unli_numbers(*args):
start = 0
for a in args:
start += a
print(start)


unli_numbers(4, 6, 40, 50, 34, 566, 345, 678, 4, 567, 43, 55, 45, 88, 89)


4
10
50
100
134
700
1045
1723
1727
2294
2337
2392
2437
2525
2614

Thanks :)
0 Halcyon Abraham Ramirez · August 20, 2015
Atay kuyawa ani bai. What are the odds bro taga bohol bya ko. Pro naa nako sa US ron. Mga 5-6 months nasad.

Sayon rna bai. Sisiw rnang python. Ga skwela kag comsci?
0 Marco Alexis · August 20, 2015
yup kabalo ko mag cebuano.ikaw?

hmm..thru suggestions in the internet. how long have you been learning python?
0 Halcyon Abraham Ramirez · August 19, 2015
That's pretty friggin mind blowing holy sh*t "he is from boho"l? so I assume that you guys  aren't living in bohol?

but still what are the odds man! do you know cebuano?

yeah there. there is www.stackoverflow.com too. that place is a goldmine of tech info. just be careful because they don't really take too well newbie questions. but here it's all fine we're all newbies.

what got you into python? 
0 Marco Alexis · August 19, 2015
Yes my father is from bohol and we always spend Christmas there.
Thanks mate. Im glad there are people willing to help whenever someone raises questions here. This is my first week learning python.
0 Halcyon Abraham Ramirez · August 18, 2015
@MarcoAlexis dang man. welcome to the world of python. I asked that because Im Filipino too and I knew somebody with a family name of Maghuyop In Bohol. Now if you happen to live in Bohol too. that would seriously blow my mind. oh and yeah. welcome to t the new boston 
  • 1
  • 2

Python

124,397 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator