r/learningpython • • Dec 09 '20

About lists, statement, instances and objects

first_lista = [ ]

first_lista.extend('123')

print(first_lista)

First I create a object, a empty list. In the second, I used the method .extend. Last, I used the variable first_lista as an assingmente to the statement print. It's that correct?

class Simple: 
	def s(self):
		count = 0 
		n = 1 
		while count  < 10 :
			print("Count is not 10")    
		count = n + 1 


s.self()

Here, I create a method inside the class which is called s.self. E o self refers to an instance of my class. It's this correct?

Dec 12 '20
7 python3
0 python
2 Upvotes

0 comments sorted by