Python Programming Tutorial – 30 – init

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts

Comments

Nick Turner says:

Hi new boston I been stuck on understanding classes for ages !!! and I have paid for material I come on here watch your video and bam ! I finally understand Amazing content dude I would pay for your series it’s fantastic thank you very much for all your effort I’m sure I’m not the only one here that appreciates it

Jason Quiveiro says:

Not cool man. -Subscribed!

Sadanand Walke says:

i typed the same code still im getting an error..And it says this

C:UsersadminAppDataLocalProgramsPythonPython36-32python.exe C:/Users/admin/PycharmProjects/untitled1/sada.py
Traceback (most recent call last):
File “C:/Users/admin/PycharmProjects/untitled1/sada.py”, line 8, in
jason = Enemy (5)
TypeError: object() takes no parameters

Process finished with exit code 1

salsa4u says:

hi, you could call it energylevel (for exemeple)in place of init and it would work, isn t it?

James Niedzialek says:

For all you Bioshock fans out there, I made this class function for you. 🙂

class Enemy:

def __init__(self, x):
self.energy = x

def get_energy(self):
print(self.energy)

Andrew_Ryan = Enemy(5)
Frank_Fontaine = Enemy(18)

Andrew_Ryan.get_energy()
Frank_Fontaine.get_energy()

print(“Andrew Ryan has 5 energy. What a nooblet!”)
print(“Franky has 18 energy. If you ask me, that lunatic had too much Adam.”)

Begzod Safarov says:

bucky is smart, he deliberately makes small videos, each with over 100k views

Dan Pollock says:

why doesn’t this video have a transcript ? i am compiling transcripts for easy back referencing if i need a refresher and this video has none :< could you add one please +thenewboston

They Pheaktra says:

Can anyone explain me, what happens if we set two value in the same init?
I got error when i tried to set one more ‘y’ value in the same Object
As: def __init__(self, x, y):

Bibek Koirala says:

fuckin tuna xD

Sabbir Ahmed Himel says:

dude you are obsessed with tuna 😀

CrazyCottageCheese says:

Excellent explanation as always.

Josiah McGlothin says:

*came to the comments to look for a Jason that was offended*

Devashree Rane says:

Is init like constructor ??

M. Ali Akbulut says:

Can you please open the auto translate from English ?? Sometimes I miss what you say so I can’t understand %100 when I dont read them.

John Harper says:

Another great tutorial!

Zachariasz Robak says:

What is a difference between using init and making it a “normal” function and using it to assign energy to enemy manualy? I do not see the advantage other than shortening the code.

Anand Jain says:

“”blrblrlbrlrblrblrblbr” – Tuna” – Bucky

Marcin Migacz says:

so sweet ! 😀 Love it ! 😀 thanks a lot! 🙂

SutharBros says:

Can you please add subtitle to this playlist. your tutorial are the best..

Rasmus Hanson says:

british wannabe init

Cat says:

dude where is the 1080p version ..

GMByte Java says:

This may be a weird question, but… where does the energy variable come from?

Vladi Ivanov says:

init = constructor

CBorgZ says:

Hey Bucky..
why your fish says “Blrrblrlbrlbrbr” if she knows human language
and can say “I am swimming” ?
This situation is not correct )))

zenix cybercube says:

7 dislikes ??? welp… 7 Jasons spotted*

Sean Corcoran says:

Thank you so much for your Python Tutorial series! I have been taking a Python class in college and have been watching your videos that correspond to my course topics for clarification. You do a great job clearly and concisely getting the point accross, particuarly for Object Oriented Programs. Keep up the good work my friend!

Dmitriy Ratushny says:

How can I get this kind of Python, is it open source? The one I have is Shell version and it looks nothing like yours, im a total noobie so forgive my ignorance

Morgan Blue says:

Ok, I bought a vertical mouse. What to do with it now? Any tutorial on that?

kareem kareem says:

الف سلامة هههه

PARTH BAMANOLIYA says:

hi sir
you are doing noble work
keep it up

Harsath Mark Zuckerberg says:

class People:
def __init__(self,name,lang):
self.name = name
self.lang = lang

def get_con(self):
if int(self.lang) <= 0: print(str(self.name),"Your life seems to be over as a programmer") else: print(str(self.name),int(self.lang),'is good hoss!!') programming = People('Crish Shean',6) programming.get_con() program = People('Harsath',2) program.get_con() google = People('Ashfa Nihar',0) google.get_con()

Talha Studios 2 says:

Man you made 4000 tutorials that is normal thing that happened to your hands

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!